Hi,

I would suggest adding a second profile which is triggered only when the
other property is specified and only executes the third script. It's a bit
of duplication, but it should work.
When both profiles get activated, the plugin configurations will get merged.

I hope this helps!
Kind regards,

Martin





On Thu, Jul 24, 2014 at 6:02 PM, hanuman <[email protected]> wrote:

> Hi All,
>
> I am trying to execute a particular sql script conditionally in a
> profile(POM.XML).
>
> Example: assume I had a following profile in a POM.xml
> if I run "mvn -Pload-test-data -e
> it's executing all scripts mentioned in SrcFiles tag.
>
> But I am trying to execute "script3.sql" only when a particular flag is
> passed as 'y'
>
> i.e..,I am looking for a command like
> mvn -Pload-test-data -e -Dref_flag='y'
> then only execute script3.sql otherwise not.
>
> Could you please assist me how we can do that?
> Thanks very much for regardin my query.
>
> Profile in my POM.xml::
>
>         <profile>
>             <id>load-test-data</id>
>             <build>
>                 <plugins>
>                     <plugin>
>                         <groupId>com.voca.maven.plugins</groupId>
>                         <artifactId>maven-database-util-plugin</artifactId>
>                         <version>0.9</version>
>                         <executions>
>                             <execution>
>                 <id>load-test-data</id>
>                                 <goals>
>                                     <goal>execute</goal>
>                                 </goals>
>                                 <configuration>
>
> <settingsKey>fps-fpsedw-db</settingsKey>
>                                     <srcFiles>
>
>       <srcFile>util/script1.sql</srcFile>
>
>       <srcFile>util/script2.sql</srcFile>
>
>       <srcFile>util/script3.sql</srcFile>
>                                     </srcFiles>
>                                 </configuration>
>                             </execution>
>                         </executions>
>                     </plugin>
>                 </plugins>
>             </build>
>         </profile>
>
>
>
> --
> View this message in context:
> http://maven.40175.n5.nabble.com/Conditionally-executing-a-script-in-profile-tp5800947.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to