Easier way to run a Java application from Maven? -
if have understood correctly, need type run project maven:
mvn compile mvn exec:java -dexec.mainclass="com.foo.bar.blah.main"
is there way can make simpler? optimally do
mvn run
1) create new profile called "run" (or name of choice)
<profiles> <profile> <id>run</id>
2) set profile's default goal "verify" (or can choose "install", choosing phase after compile ensure code automatically compiled before running class)
<profiles> <profile> <id>run</id> <build> <defaultgoal>verify</defaultgoal>
3) add exec-maven-plugin profile (see this), configure run in 'verify' phase.
<execution> <phase>test</phase>
4) can run class using following:
mvn -prun
Comments
Post a Comment