错误:Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sz15732624895/article/details/82151055

报错信息:

[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,项目运行成功。

项目运行成功:

猜你喜欢

转载自blog.csdn.net/sz15732624895/article/details/82151055