Sunday, October 27, 2013

I'd like to set a property if an environment variable is set. I googled a lot on it and all I found is something similar to the code below, but I keep getting the error:
*[FATAL] Non-parseable POM Y:\Maven\parent-pom\pom.xml: TEXT must be immediately followed by END_TAG and not START_TAG (position: START_TAG s een ...roperties"\r\n classpathref="maven.plugin.classpath" />... @29:55) @ line 29, column 55*
That's the code I'm trying, its inside a pom.xml and I ran the command -
mvn --errors deploy
Of course, I'll be happy to get any other solution, if you have other suggestion on how to set a property in pom.xml depending on an environment variable content.
Thanks, Eli
    
       .....
    
resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> arg1="${env.WAS60_HOME}" arg2=""\> ${env.WAS60_HOME} ${was60.home}/java/bin/javac arg1="${env.WAS85_HOME}" arg2=""\> ${env.WAS85_HOME} ${was85.home}/java/bin/javac was.base.v60 .... ${was60.home}/java/jre/lib/xml.jar ..... was.base.v85 .... ${was85.home}/java/jre/lib/xml.jar .....
share|improve this question

3 Answers

usage of tasks inside properties tag is wired , use maven-antrun plugin instead. you can set maven properties with


maven-antrun-plugin
1.3 ftp package run resource="net/sf/antcontrib/antcontrib.properties" classpathref="maven.plugin.classpath" /> arg1="${ftp}" arg2="true" /> message="The value of property ftp is true" /> message="The value of property ftp is not true" /> true ant-contrib ant-contrib 20020829
share|improve this answer
 
Can you please give me an example ? I couldn't find it in the link you sent –  Elyahu Aug 5 at 8:44
A much better approach would be to use profile activations.

  
    was.base.v60
env.WAS60_HOME .... ${env.WAS60_HOME}/java/jre/lib/xml.jar ..... was.base.v85 env.WAS85_HOME .... ${env.WAS85_HOME}/java/jre/lib/xml.jar .....

Update:

My preferred way to use profiles is to have a default set of properties in my POM and then override these on demand using profiles in my settings file.
This approach is easy to do explicitly by using the "-s" and "-P" commandline parameters:
mvn -s $PROJECT_SETTINGS -P myProfile ....
This approach is easy to maintain in Jenkins using Config File Provider plugin which enables a GUI for editing the various settings files I use for each project.

Update 2:

Here's an example of how I setup my builds. The POM contains a section with the default property values. And I setup one or more pfiles to over-ride these values:

  
     hello
world .. .. build_in_spanish hola mundo .. build_in_irish dia dhuit an domhain ..
So in this example the build defaults to English. To run the build with the settings in Spanish
mvn -P build_in_spanish ...
Note:
  • Profiles can be in the POM or in a separated settings file. The latter approach gives the most flexibility.
  • Profiles can be explicitly enabled (using the "-P" command line option or by attempting to discover the environment it sits within. This is a design choice)
share|improve this answer

3 comments:

Unknown said...


zhengjx20160721
adidas superstar shoes
supra footwear
jordan concords
christian louboutin shoes
longchamp le pliage
rolex watches
fit flops
coach outlet store online clearances
celine bags
ray ban sunglasses outlet
kate spade outlet
oakley outlet
louis vuitton outlet online
louis vuitton
ray ban sunglasses outlet
toms shoes
replica rolex watches
michael kors outlet clearance
jordan retro 4
kobe 8
coach factory outlet online
rolex watches
nike free uk
coach factory outlet
air max
kate spade handbags
louis vuitton outlet stores
cheap ray ban sunglasses
kd 8
ralph lauren polo
air jordan 4
jordan 6s
air jordan homme
michael kors outlet clearance
rolex watches
louis vuitton handbags
designer handbags
coach outlet online
cheap basketball shoes
oakley canada

raybanoutlet001 said...

fitflops sale
cheap air jordans
huarache shoes
nike huarache sale
cheap jordans
air jordan shoes
michael kors handbags
cheap jordans online
michael kors outlet
michael kors outlet
nike huarache
michael kors handbags,michael kors handbags clearance,michael kors clearance
nfl jerseys from china
true religion store
nmd adidas store
air jordan shoes
adidas yeezy boost
michael kors outlet online
http://www.outlettiffanyand.co
tiffany and co outlet
adidas stan smith
tiffany jewelry
http://www.oakleystoreonline.us.org
ugg outlet

jeje said...

D'autres se spécialisent seulement dans le glaucome, la cornée, air jordan france store la rétine ou dans les cataractes. Alors que la conception de ces chaussures est plus ou moins la même chose, vous pouvez trouver quelques détails qui sont utilisés pour distinguer les chaussures Nike réelles et faux. Le probable de la bioélectronique est également montré dans ces films. Pendant quelque temps après, les baskets Nike Shox Qualify n'étaient utilisées adidas zx 750 gris que pour les activités sportives. Ceci est très efficace sur les sites de produits car les acheteurs sont formés pour rechercher ces images avec leur achat potentiel à l'intérieur. Beaucoup pensent que la ligne de chaussures DC et d'autres de ce marché vont faire des progrès cette année et réduire les ventes sur les chaussures nike lunar ballistec 1.5 autres marchés en 2011.