Maven Ant Task: Replace property in pom.xml when executing Maven from Ant
In my Ant script, i'm executing Maven like this:
<artifact:mvn pom="${basedir}/pom.xml">
<arg val开发者_JAVA技巧ue="glassfish:deploy" />
</artifact:mvn>
In my pom.xml, there is a property:
<properties>
<glassfish.home>${env.GLASSFISH}</glassfish.home>
</properties>
This value should be replaced by a value thats provided by the Ant Script. Is it possible to overwrite an existing property in the pom.xml when executing it with the Ant Maven Task? Whats the easiest way to do this?
I forgot that you can simply pass properties to a Maven build on the command line. So to change the property from Ant, i inserted another arg, like this:
<property name="GLASSFISH" value="${basedir}/glassfish"/>
<artifact:mvn pom="${basedir}/pom.xml">
<arg value="glassfish:deploy" />
<arg value="-Dglassfish.home=${GLASSFISH}"/>
</artifact:mvn>
Works fine.
精彩评论