maven热部署时遇到的问题

时间:2022-09-16 21:22:40

问题1--

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building sport 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] >>> tomcat7-maven-plugin:2.2:deploy (default-cli) @ sport >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ sport ---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ sport ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ sport---
[debug] execute contextualize
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory G:\xinbaba\babasport-back\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ sport ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ babasport-back ---
[INFO] Surefire report directory: G:\xinbaba\sport\target\surefire-reports


-------------------------------------------------------
 T E S T S
-------------------------------------------------------


Results :


Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


[INFO] 
[INFO] --- maven-war-plugin:2.1.1:war (default-war) @ sport ---
[INFO] Packaging webapp
[INFO] Assembling webapp [sport] in [G:\xinbaba\babasport-back\target\sport0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [G:\xinbaba\babasport-back\src\main\webapp]
[INFO] Webapp assembled in [24 msecs]
[INFO] Building war: G:\xinbaba\sport\target\sport-0.0.1-SNAPSHOT.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored 
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO] 
[INFO] <<< tomcat7-maven-plugin:2.2:deploy (default-cli) @ sport<<<
[INFO] 
[INFO] --- tomcat7-maven-plugin:2.2:deploy (default-cli) @sport ---
[INFO] Deploying war to http://localhost:8080/sport  
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Uploading: http://localhost:8080/manager/text/deploy?path=%2Fsport
Uploaded: http://localhost:8080/manager/text/deploy?path=%2Fsport(3 KB)



[ERROR] Tomcat return http status error: 404, Reason Phrase: Not Found
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.389s
[INFO] Finished at: Fri Dec 15 18:04:41 CST 2017
[INFO] Final Memory: 9M/23M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project sport: Tomcat return http status error: 404, Reason Phrase: Not Found: -> [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

pom中的tomcat配置

 <build>
  <plugins>
  <plugin>
  <groupId>org.apache.tomcat.maven</groupId>
  <artifactId>tomcat7-maven-plugin</artifactId>
  <version>2.2</version>
  <configuration>
  <!-- 请求路径  Tomcat -->
  <url>http://localhost:8080/manager/text</url>
  <!-- 用户名 -->
  <username>tomcat</username>
  <!-- 密码 -->
  <password>123456</password>
  </configuration>
  </plugin>
  </plugins>
  </build>




在热部署的时候出现 显示uploading已经完成,但是出现error的错误,在tomcat的webapp下并没有项目和war的产生 ,同时pom中的配置也已经ok,

Tomcat return http status error: 404, Reason Phrase: Not Found: 这里是说tTomcat返回HTTP状态错误:404,最终发现是在热部署的时候,eclipse启动了tomcat,资源被占用,未能部署成功,关闭tomcat,启动外部的tomcat热部署成功