Created
January 21, 2013 20:59
-
-
Save rladstaetter/4589329 to your computer and use it in GitHub Desktop.
An example for calling ant from maven using a property file for storing values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project default="main"> | |
<target name="main"> | |
<echo message="This line is executed in an external build.xml for javafx version: ${javafx.version}"/> | |
</target> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>net.ladstatt.maven</groupId> | |
<artifactId>example-pom-with-filtering</artifactId> | |
<version>1.0.0-SNAPSHOT</version> | |
<packaging>jar</packaging> | |
<name>example-pom-with-filtering</name> | |
<url>http://maven.apache.org</url> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
</properties> | |
<build> | |
<filters> | |
<filter>props.properties</filter> | |
</filters> | |
<plugins> | |
<!-- http://mojo.codehaus.org/properties-maven-plugin/ --> | |
<plugin> | |
<groupId>org.codehaus.mojo</groupId> | |
<artifactId>properties-maven-plugin</artifactId> | |
<version>1.0-alpha-2</version> | |
<executions> | |
<execution> | |
<phase>validate</phase> | |
<goals> | |
<goal>read-project-properties</goal> | |
</goals> | |
<configuration> | |
<files> | |
<file>props.properties</file> | |
</files> | |
</configuration> | |
</execution> | |
</executions> | |
</plugin> | |
<plugin> | |
<artifactId>maven-antrun-plugin</artifactId> | |
<version>1.7</version> | |
<executions> | |
<execution> | |
<phase>package</phase> | |
<configuration> | |
<target> | |
<!-- Place any Ant task here. You can add anything you can add between | |
<target> and </target> in a build.xml. --> | |
<property name="a.version" value="${a.version}" /> | |
<ant antfile="build.xml" /> | |
<echo | |
message="This is ant called from maven for and providing a version number from a property file ${a.version}" /> | |
</target> | |
</configuration> | |
<goals> | |
<goal>run</goal> | |
</goals> | |
</execution> | |
</executions> | |
</plugin> | |
</plugins> | |
</build> | |
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>4.10</version> | |
</dependency> | |
</dependencies> | |
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a.version=1.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this - couldn't quite figure out how to do this with the ant-run plugin.