tags:

views:

26

answers:

1

I am considering converting an Ant/Ivy project to Ant/Maven-Ant-Tasks. I do not want to use Maven by itself because I need more control over the build process.

Is there any way for the Ant build.xml file inherit properties set in the pom.xml file?

I have been creating a generic build.xml file that can be used across several projects and loads a project-specific project.properties file, but it would be nicer if I could put all of those properties in the pom.xml file.

Thanks.

+1  A: 

I use the XMLProperty ant task to parse and copy those properties

http://ant.apache.org/manual/Tasks/xmlproperty.html

<xmlproperty file="<your pom location>" keepRoot="false"/>
<property name="test"   value="${properties.test}"/>

Another option, if you use the maven Antrun plugin to run the build, the properties will be available to use in the build file

http://maven.apache.org/plugins/maven-antrun-plugin/usage.html

shipmaster