Solve springboot items packaged mvnw error Could not find or load main class org.apache.maven.wrapper.MavenWrapperMain

Reprinted from: https://blog.csdn.net/blueheart20/article/details/52185440

Introduction: Occasionally Spring Boot of course, you'll run into this error, so the problem all over the world to find, in fact, sometimes you are wrong, not a maven's fault, but some of the settings will spring boot itself there, we will resolve this error.

1. Error Messages

   After downloading a spring boot project, to be run when the project started, it was found not start, reported the following error message:

[root @ flybird WXDemo] # ./mvnw
Error: Could not the Find or the Load main class org.apache.maven.wrapper.MavenWrapperMain
2. analysis
   First question itself is in accordance with the direction set to mvn analysis, M2_HOME, PATH and other environment variables through a check and found no problems. Then switch the version of the maven, was not able to solve the problem, so the network a pass search around, but he has said, should be an environment variable mismatch problems caused, in fact, I always think it should not be the reason, because mvn can work .

   So another idea is something not spring boot to bring a set of modified maven, check Along the way, omnipotent google help us find the answer, the lack of a certain configuration information and jar package.

3. solve the problem

    The instructions say to use the Internet: mvn -N io.takari: maven: wrapper

mvn –N io.takari:maven:wrapper
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WXDemo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping WXDemo
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.909 s
[INFO] Finished at: 2016-08-11T18:43:48+08:00
[INFO] Final Memory: 8M/29M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "–N". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-RUN a using Maven at The -X Switch to enable Full Debug logging.
[ERROR]
[ERROR] the About the For More Information at The errors and Possible Solutions, the Read Please at The following Articles:
[ERROR] [Help 1] HTTP: / /cwiki.apache.org/confluence/display/MAVEN/LifecyclePhaseNotFoundException
 results of the analysis, -N does not support this argument, well, it would be better to remove.
  Implementation of the new command: mvn io.takari: maven: wrapper


[root@test WXDemo]# mvn io.takari:maven:wrapper
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building WXDemo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven:0.3.3:wrapper (default-cli) @ meal ---
[INFO]
[INFO] The Maven Wrapper has been successfully setup for your project.
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.693 s
[The INFO] Finished AT: 2016-08-11T18: 45: 51 is + 08: 00
[the INFO] Final Memory: 9M / 29M
[the INFO] ------------------- -------------------------------------------------- ---
 4. verify mvnw command
    execution instruction: ./mvnw

[root@test WXDemo]# ./mvnw

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.812 s
[INFO] Finished at: 2016-08-11T18:46:33+08:00
[INFO] Final Memory: 8M/29M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-RUN a using Maven at The -X Switch to enable Full Debug logging.
[ERROR]
[ERROR] the About the For More Information at The errors and Possible Solutions, the Read Please at The following Articles:
[ERROR] [Help 1] HTTP: / /cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifiedException
 can perform normal this wretched commands.
5. mvn version

   -N parameter in official documents given does not support the problem can be attributed to the change and migration between mvn version. mvn version information for this test appears as follows:

[root@flybird WXMeal]# mvn -version
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T19:57:37+08:00)
Maven home: /opt/maven
Java version: 1.8.0_91, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.91-0.b14.el7_2.x86_64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.10.0-327.3.1.el7.x86_64", arch: "amd64", family: "unix"

----------------
Disclaimer: This article is CSDN blogger "bladestone 'original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement. .
Original link: https: //blog.csdn.net/blueheart20/article/details/52185440

Guess you like

Origin www.cnblogs.com/marcoreus/p/12579844.html