錯誤:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2
阿新 • • 發佈:2019-02-09
報錯資訊:
[INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] e3-manager ......................................... SUCCESS [ 1.286 s] [INFO] e3-manager-pojo .................................... SUCCESS [ 0.676 s] [INFO] e3-manager-dao ..................................... SUCCESS [ 0.168 s] [INFO] e3-manager-interface ............................... SUCCESS [ 0.113 s] [INFO] e3-manager-service ................................. SUCCESS [ 0.152 s] [INFO] e3-manager-web ..................................... FAILURE [ 1.496 s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 4.345 s [INFO] Finished at: 2018-08-28T14:08:53+08:00 [INFO] Final Memory: 18M/207M [INFO] ------------------------------------------------------------------------ [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] [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/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :e3-manager-web
顯示的錯誤資訊:找不到Tomcat,開啟Tomcat失敗。
查詢過程:本專案是在manager裡面的pom.xml內配置的Tomcat外掛:
<!-- 配置tomcat外掛 --> <build> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <configuration> <path>/</path> <port>8080</port> </configuration> </plugin> </plugins> </build>
而manager的Tomcat是引用的parent裡面的pom.xml內配置的Tomcat外掛:
<!-- 配置Tomcat外掛 -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
原因:是jdk版本的問題,Tomcat7預設使用的jdk是jdk1.7。我原來配置的是1.8,所以一直報錯。
後來在 windows-preference-java-Installed JREs 裡面配置jdk版本為1.7,專案執行成功。
專案執行成功: