tags:

views:

247

answers:

1

In my Ant script, i'm executing Maven like this:

<artifact:mvn pom="${basedir}/pom.xml">
  <arg value="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?

+3  A: 

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.

ifischer