Hi all,

As recommended by the antrun
plugin<http://maven.apache.org/plugins/maven-antrun-plugin/introduction.html>,
I'd like to "move all my Ant tasks to a build.xml file and just call it from
the POM using Ant's <ant/> task<http://ant.apache.org/manual/CoreTasks/ant.html>
."

I need to use some of the Maven properties (${project.build.directory}, ${
project.build.outputDirectory}, etc.) inside the build.xml, unfortunately it
seems that those properties are not inherited from the Maven Project.

To be precise, Maven properties are available in the Maven <tasks> tag but
not passed to the <ant> task.

<configuration>
   <tasks>
       <!-- Maven properties are available inside the <tasks>... -->
       <echo>${project.build.directory}</echo>

       <!-- but not in the build.xml file! -->
       <ant dir="${basedir}"
            antfile="build.xml"
       />
   </tasks>
</configuration>


The only workaround I found out is to explicitly declare the properties
before or inside the <ant> tag.
But you will agree that this not really neat nor efficient.

<configuration>
   <tasks>
       <!-- Pass all the properties that may be needed in the ant file -->
       <property name="project.build.directory" value="${
project.build.directory}"/>

       <ant dir="${basedir}"
            antfile="build-test.xml"
       />
   </tasks>
</configuration>

Does anyone have a solution please?

Thanks in advance for your help,

Alexis

Reply via email to