|
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 |
|
Alexis,
i've experimented with this as well and ended up with the same solution as you. I'm afraid that may be the only option for now. On 7/27/06, Alexis Midon <[hidden email]> wrote: > 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 > > -- Toli Kuznets http://www.marketcetera.com: Open-Source Trading Platform download.run.trade. --------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email] |
|
Hi Toli,
I post my question on my blog <http://jroller.com/page/alexism>too and I got a useful answer from Ruben<http://jroller.com/page/alexism?entry=maven2_antrun_plugin#comment3> He suggests me to use the maven ant-task inside the build.xml itself. http://maven.apache.org/ant-tasks.html Actually the pom task <http://maven.apache.org/ant-tasks.html#POM> will load a POM file and make it available as a reference for the other tasks or as properties. That could be a neat solution, don't you think? Alexis On 7/27/06, Toli Kuznets <[hidden email]> wrote: > > Alexis, > > i've experimented with this as well and ended up with the same > solution as you. I'm afraid that may be the only option for now. > > On 7/27/06, Alexis Midon <[hidden email]> wrote: > > 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 > > > > > > > -- > Toli Kuznets > http://www.marketcetera.com: Open-Source Trading Platform > download.run.trade. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [hidden email] > For additional commands, e-mail: [hidden email] > > |
| Powered by Nabble | Edit this page |
