Using m2eclipse, what is the simplest way to use the Codehaus Mojo Exec Plugin to launch my project without leaving eclipse? So far on the pom plugins screen I have set up the org.codehuas.mojo plugin.
Specifically, I would like to execute the following from inside eclipse:
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main
Create a run configuration by click "Run → Run Configurations", select Maven Build and click "New launch configuration", type Name "OpenMRS", select working directory to be the root of webapp project, type goal "jetty:run" and save. Now you select "OpenMRS" and run or debug it.
You can run Maven goals from Eclipse. You can view the output of Maven commands inside the Eclipse, using its own console. You can update maven dependencies with IDE. You can Launch Maven builds from within Eclipse.
mvn exec:java is a goal from the exec plugin for maven. It lets you specify a main class to execute (see pom. xml). This lets you avoid having to figure out the proper java command to run and classpath arguments and the like.
This is how it looks on my set-up:
PD: if you have set the mainClass argument on the pom.xml, then the parameter from the execution will be disregarded.
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