I’ve embedded the following code within my POM:
<plugin name="test">
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<tasks>
<pathconvert targetos="unix" property="project.build.directory.portable">
<path location="${project.build.directory}"/>
</pathconvert>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
I then reference ${project.build.directory.portable} from the run project action but it comes back as null. Executing <echo> within the Ant block shows the correct value. What am I doing wrong?
For completeness, the mentioned feature was implemented in the
maven-antrun-pluginin October 2010.The configuration parameter you are looking for is
exportAntProperties.Example of use:
As a side note, at the time of this post (2011-10-20), the official plugin documentation didn’t have this option documented. To get the help for ‘versionXYZ’ of the plugin: