2

The Exec Maven Plugin Documentation states for the java goal that I can provide the main class parameter like this:

mvn exec:java -Dexec.mainClass="com.my.MainClass"

However when I invoke the goal this way I always get this error:

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java (default-cli) on project APIEndpoint: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.5.0:java are missing or invalid -> [Help 1]

The class is compiled and resides in target > classes > com > my. What am I missing here? Do I need to add the plugin to my pom.xml but without the configuration tags? Am I correct to assume that maven and the exec goal do all the classpath resolving automatically?

codemusings
  • 117
  • 1
  • 5
  • Strange. Getting this error as well. Should work though :( – AlikElzin-kilaka Feb 24 '18 at 10:43
  • Are you trying to run the "main" class from a spring boot project? This might be the problem. spring-boot creates the jar in a different way (different inner folder) and runs the user's code from a different class loader. A different ball game. – AlikElzin-kilaka Feb 24 '18 at 11:09

0 Answers0