Error while executing Maven project Java-mongoDB mvn command using CMD

803 Views Asked by At

Command :

mvn compile exec:java -Dexec-mainClass="com.tengen.HelloWorldMongoDBStyle"
or
mvn compile exec:java -Dexec-mainClass="com.tengen.HelloWorldMongoDBStyle.java"

Error Log in Command line : (but this project is working fine in Intellij Editor)

[INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building M101J 1.0-SNAPSHOT [INFO] ------------------------------------------------------------------------ [INFO] [INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ M101J --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory C:\rde\apache-maven-3.2.3\projects\M101J\src\main\resources [INFO] [INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ M101J --- [INFO] Nothing to compile - all classes are up to date [INFO] [INFO] --- exec-maven-plugin:1.3.2:java (default-cli) @ M101J --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3.247 s [INFO] Finished at: 2014-11-26T19:34:44+05:30 [INFO] Final Memory: 10M/147M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project M101J: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java are missing or invalid -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException

1

There are 1 best solutions below

0
On BEST ANSWER

Your parameter name is incorrect. It should be -Dexec.mainClass="com.tengen.HelloWorldMongoDBStyle". See here for more information.