AW: Conditionally executing a script in profile

2014-07-24 Thread Bernd Eckenfels
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 hanumannallap...@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
idload-test-data/id
build
plugins
plugin
groupIdcom.voca.maven.plugins/groupId
artifactIdmaven-database-util-plugin/artifactId
version0.9/version
executions
execution
idload-test-data/id
goals
goalexecute/goal
/goals
configuration
settingsKeyfps-fpsedw-db/settingsKey
srcFiles

srcFileutil/script1.sql/srcFile

srcFileutil/script2.sql/srcFile

srcFileutil/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-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: AW: Conditionally executing a script in profile

2014-07-24 Thread hanuman
thanks very much(martin and brend) for your prompt replies .

i.e.., can I conditionally invoke a profile within the other profile?
 or
create a two profiles and run a separate command for each of them?
  ex: mvn -Pcreate-profile1 -e(to execute script1 and script2
.sql)
   mvn -Pcreate-profile2 -e(to execute script3.sql)



--
View this message in context: 
http://maven.40175.n5.nabble.com/Conditionally-executing-a-script-in-profile-tp5800947p5800950.html
Sent from the Maven - Users mailing list archive at Nabble.com.

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: AW: Conditionally executing a script in profile

2014-07-24 Thread Martin Todorov
You cannot conditionally trigger one profile from within the other. You
will need to have two separate ones.


On Thu, Jul 24, 2014 at 6:17 PM, hanuman hanumannallap...@gmail.com wrote:

 thanks very much(martin and brend) for your prompt replies .

 i.e.., can I conditionally invoke a profile within the other profile?
  or
 create a two profiles and run a separate command for each of them?
   ex: mvn -Pcreate-profile1 -e(to execute script1 and script2
 .sql)
mvn -Pcreate-profile2 -e(to execute script3.sql)



 --
 View this message in context:
 http://maven.40175.n5.nabble.com/Conditionally-executing-a-script-in-profile-tp5800947p5800950.html
 Sent from the Maven - Users mailing list archive at Nabble.com.

 -
 To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
 For additional commands, e-mail: users-h...@maven.apache.org




Re: AW: Conditionally executing a script in profile

2014-07-24 Thread Ron Wheeler

http://books.sonatype.com/mvnref-book/reference/profiles-sect-activation.html#profiles-sect-activation-config
suggests that you might be able to split your task into 2 sections.

Put the first 2 sql scripts  in a profile that is always activated and 
put the 3rd one into a profile that is only activated when the condition 
that you specify is true.


The hyperlink provides some way to indicate that you want the second 
profile to be active.


Ron

On 24/07/2014 1:10 PM, Bernd Eckenfels wrote:

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



--
Ron Wheeler
President
Artifact Software Inc
email: rwhee...@artifact-software.com
skype: ronaldmwheeler
phone: 866-970-2435, ext 102


-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org