Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn exec:exec and mvn exec:java difference

Tags:

java

maven

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.

like image 574
Segmented Avatar asked May 23 '14 14:05

Segmented


People also ask

What does Mvn exec Java do?

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.

What is exec Java?

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).


2 Answers

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.

like image 122
TheMP Avatar answered Sep 23 '22 17:09

TheMP


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.

like image 27
khmarbaise Avatar answered Sep 21 '22 17:09

khmarbaise