Hello. I have maven project and ant task for it. In ant task i want to get version property from pom.xml. How to get it?
In pom.xml: <version>2.03.010</version>
Hello. I have maven project and ant task for it. In ant task i want to get version property from pom.xml. How to get it?
In pom.xml: <version>2.03.010</version>
The Maven Ant tasks provide some goals for POM processing
To access the version from a POM, you can use the following:
<artifact:pom id="mypom" file="pom.xml" />
<echo>The version is ${mypom.version}</echo>
Update: To use the tasks. You will need to install them. Install instructions
You can either:
With option 2. you modify your project as follows to make ant aware of the maven-ant-tasks schema:
<project ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">
...
</project>
With option 3. You specify the typedef as follows (assuming the maven-ant-tasks jar is in the lib directory of your project):
<project ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">
...
<path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.10.jar" />
<typedef resource="org/apache/maven/artifact/ant/antlib.xml"
uri="antlib:org.apache.maven.artifact.ant"
classpathref="maven-ant-tasks.classpath" />
...
</project>