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.
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.
I used this answer from @Adam Siemion above, but I didn't want separate targets for running on Windows or Linux. Instead I just set the property near the top of my ant script:
Then in the middle of my script I use an if-then-else statement:
Here there is a complete solution:
The output is something like this...
An example of use of exec task utilizing Maven run from the Windows CLI would be:
You can use the exec task and call
mvn compile
as a terminal command. This is not ideal since you won't have any control over the execution, but otherwise I don't think there is a way to execute a Maven goal.You may use a
java
task (this example is similar to @mateusz.fiolka answer but also works on Linux)tested with maven 3.0.5
From Thiagoh answer, I have to add this to make it work.