maven exec plugin

The maven exec plugin, how to execute a Java program as part of your maven build. Snippet showing how to add the plugin to pom.xml

Published: Saturday, 25 June 2011

Maven exec plugin: Running Java programs during maven builds

Sometimes it is easier to run or execute a Java program instead of writing a maven plugin.

In the following example, the class com.magicmonster.example.Main will be run. Note the phase has to come after the ‘compile’ phase if your main class is from your current project. Alternatively, if the main class is included via a maven dependency, any phase will work.