錯誤:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2

錯誤:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2

轉發:https://blog.csdn.net/sz15732624895/article/details/82151055

報錯信息:

  1. [INFO] ------------------------------------------------------------------------

  2. [INFO] Reactor Summary:

  3. [INFO]

  4. [INFO] e3-manager ......................................... SUCCESS [ 1.286 s]

  5. [INFO] e3-manager-pojo .................................... SUCCESS [ 0.676 s]

  6. [INFO] e3-manager-dao ..................................... SUCCESS [ 0.168 s]

  7. [INFO] e3-manager-interface ............................... SUCCESS [ 0.113 s]

  8. [INFO] e3-manager-service ................................. SUCCESS [ 0.152 s]

  9. [INFO] e3-manager-web ..................................... FAILURE [ 1.496 s]

  10. [INFO] ------------------------------------------------------------------------

  11. [INFO] BUILD FAILURE

  12. [INFO] ------------------------------------------------------------------------

  13. [INFO] Total time: 4.345 s

  14. [INFO] Finished at: 2018-08-28T14:08:53+08:00

  15. [INFO] Final Memory: 18M/207M

  16. [INFO] ------------------------------------------------------------------------

  17. [ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:run (default-cli) on project e3-manager-web: Could not start Tomcat: Failed to start component [StandardServer[-1]]: Failed to start component [StandardService[Tomcat]]: Failed to start component [StandardEngine[Tomcat]]: A child container failed during start -> [Help 1]

  18. [ERROR]

  19. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

  20. [ERROR] Re-run Maven using the -X switch to enable full debug logging.

  21. [ERROR]

  22. [ERROR] For more information about the errors and possible solutions, please read the following articles:

  23. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

  24. [ERROR]

  25. [ERROR] After correcting the problems, you can resume the build with the command

  26. [ERROR] mvn <goals> -rf :e3-manager-web

顯示的錯誤信息:找不到Tomcat,打開Tomcat失敗。

查詢過程:本項目是在manager裏面的pom.xml內配置的Tomcat插件:


 
  1. <!-- 配置tomcat插件 -->

  2. <build>

  3. <plugins>

  4. <plugin>

  5. <groupId>org.apache.tomcat.maven</groupId>

  6. <artifactId>tomcat7-maven-plugin</artifactId>

  7. <configuration>

  8. <path>/</path>

  9. <port>8080</port>

  10. </configuration>

  11. </plugin>

  12. </plugins>

  13. </build>

而manager的Tomcat是引用的parent裏面的pom.xml內配置的Tomcat插件:


 
  1. <!-- 配置Tomcat插件 -->

  2. <plugin>

  3. <groupId>org.apache.tomcat.maven</groupId>

  4. <artifactId>tomcat7-maven-plugin</artifactId>

  5. <version>2.2</version>

  6. </plugin>

原因:是jdk版本的問題,Tomcat7默認使用的jdk是jdk1.7。我原來配置的是1.8,所以一直報錯。

後來在 windows-preference-java-Installed JREs 裏面配置jdk版本爲1.7,項目運行成功。

項目運行成功:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章