Dunith Dhanushka Dunith Dhanushka - 1 year ago 90
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.

Answer Source

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" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download