I am implementing maven wrapper to ant builds. And the ant command used to build the project is as follows
ant -v -f build.xml -Darch=linux-java7 -Dconfig=/work/build.config -Doutput=/work/bldout/
Now i have to execute the above command through maven . I tried to implement this using "I want to execute shell commands from maven's pom.xml" and "http://sanchitbahal.wordpress.com/2011/09/19/maven-exec-plugin-vs-maven-antrun-plugin-for-running-command-line-tool/"
The sample code i tried inside my pom.xml is as follows :
<plugin>
<artifactId>exec-maven-plugin</artifactId>
<groupId>org.codehaus.mojo</groupId>
<executions>
<execution>
<id>execute-shell</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>test.sh</executable>
<arguments>
<argument>ARG1</argument>
<argument>ARG2</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
But i am not able to figure out how to pass named parameter such as "-Darch=linux-java7" as arguement to build.xml
Also used maven-antrun plugin to invoke build.xml as follows :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>run-target</id>
<phase>install</phase>
<configuration>
<target>
<ant antfile="build.xml" target="all" />
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
But here also i am unable to figure out how to pass parameter such as "-Darch=linux-java7" as arguement to build.xml
What i know is that i can put the command in a shell script(in a .sh file) and call the shell script using maven-exec-plugin , but wanted to know if it is possible to do without doing so .