Tuesday, May 10, 2011

Exec Maven Plugin

This plugin is very useful while executing system and java programs.It provides two goals as;
  • exec:exec execute programs and Java programs in a separate process.
  • exec:java execute Java programs in the same VM.
The benefit of this plugin is we can execute the program without any IDE and using this maven plugin.
I will explain how to use exec:java goal in a simple helloWorld program.
  • First create a new maven project.Here I used IntelliJIDEA.
  • Then add a java class to it with having the main method.For the moment just add a System.out in that method.
  • Then add the following configurations to it's pom.xml file.

  • Next build the project using 'mvn install' .
  • Finally invoke 'mvn exec:java -o'.
  • Then the program will execute and the terminal result will displays as follows.

For further info,visit

No comments:

Post a Comment