Dunith Dhanushka Dunith Dhanushka - 10 days ago 5x
Java Question

How to call for a Maven goal within an Ant script?

Is it possible to call or execute a Maven goal within an Ant script?

Say I have an ant target called 'distribute' and inside which I need to call a maven 'compile' goal from another pom.xml.


An example of use of exec task utilizing Maven run from the Windows CLI would be:

<target name="buildProject" description="Builds the individual project">
    <exec dir="${source.dir}\${projectName}" executable="cmd">
        <arg value="/C"/>
        <arg value="${env.MAVEN_HOME}\bin\mvn.bat"/>
        <arg line="clean install" />