maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernd Eckenfels <e...@zusammenkunft.net>
Subject AW: Conditionally executing a script in profile
Date Thu, 24 Jul 2014 17:10:02 GMT
There are two typical things done - you either use two profiles or you use a plugin which supports
a skip property.

 other ways are hard to understand (like adding a property to the include pattern to make
it not find the resource) and should be avoided.

i dont know if your particular mentioned DB Plugin supports more configuration.

Bernd
-- 
http://bernd.eckenfels.net

----- Ursprüngliche Nachricht -----
Von: "hanuman" <hanumannallapati@gmail.com>
Gesendet: ‎24.‎07.‎2014 19:02
An: "users@maven.apache.org" <users@maven.apache.org>
Betreff: Conditionally executing a script in profile

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message