0 votes
1 view
in Java by (2.6k points)

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 Answer

0 votes
by (46.1k points)

See the exec maven plugin. You can run Java classes practicing:

mvn exec:java -

Dexec.mainClass="com.example.Main" [-Dexec.args="argument1"] ...

The invocation can be as manageable as mvn exec:java if the plugin arrangement is in your pom.xml. The plugin site on Mojohaus has a more detailed example.


















Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !