I have gone through the documentation at @ codehaus exec-maven-plugin usage. I understand that the exec:java allows the user to execute the java program, in the same VM as they state. I am a newbie in maven and my aim is to understand the difference between mvn exec:exec
and mvn exec:java
so that I can apply them better.
Maven exec plugin allows us to execute system and Java programs from the maven command. There are two goals of the maven exec plugin: exec:exec - can be used to execute any program in a separate process. exec:java - can be used to run a Java program in the same VM.
exec(String command) method executes the specified string command in a separate process. This is a convenience method. An invocation of the form exec(command) behaves in exactly the same way as the invocation exec(command, null, null).
You use mvn exec:java when you are working with java classes and want to run them in your JVM (with all project dependencies as classpath), whilst mvn exec:exec allows you to run any executable (like shell script to do some cleanup or windows batch file), not only the java ones.
The main page of the documentation gives a short overview:
exec:exec execute programs and Java programs in a separate process.
exec:java execute Java programs in the same VM.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With