Is there a Maven "phase" or "goal" to simply execute the main method of a Java class? I have a project that I'd like to test manually by simply doing something like "mvn run".
+1
A:
Not sure why you want to do this. If you are developing in an IDE you can debug a type with a main method. What would be the benefit of using Maven to start the application?
Rich Seller
2009-07-06 21:37:48
There are quite a few use cases for this. I tend to try to be IDE-agnostic. Coding a whole project from scratch, I'd use an IDE. To just troubleshoot and test out a few cases, I'd happily bring up vim, add in a few logging statements and use the tools that maven gives me.
feicipet
2009-07-07 00:40:03
+10
A:
See the maven exec plugin. You can run Java classes using:
mvn exec:java -Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ...
Robert Munteanu
2009-07-06 21:39:10