我正在尝试使用tomcat-maven-plugin6自动部署war文件到apache-tomcat-server( 6.0.33 ),但是在tomcat:deploy命令,maven(3.5.1 / 1.5.1。 xxx EclipseIDE-embedded正在尝试安装到错误的URL(localhost:8080 / webapplication),我在这里看到类似的Q& A (1,2),但它是答案并没有解决我的问题。请在下面找到更多详细信息。
将Settings.xml
<servers>
<server>
<id>localhost</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
的pom.xml
<plugin>
<groupId> org.apache.tomcat.maven</groupId>
<artifactId>tomcat6-maven-plugin</artifactId>
<version>2.0-beta-1</version>
<configuration>
<url>http://localhost:8080/manager</url>
<!-- <username>usr</username> <password>pwd</password> -->
<server>localhost</server>
<path>/datatest</path>
<warFile>target/service-manager.war</warFile>
</configuration>
</plugin>
Maven控制台:
[INFO] <<< tomcat-maven-plugin:1.1:deploy (default-cli) @ service-manager <<<
[INFO]
[INFO] --- tomcat-maven-plugin:1.1:deploy (default-cli) @ service-manager ---
[INFO] Deploying war to http://localhost:8080/service-manager
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Data manager ...................................... SUCCESS [ 7.454 s]
[INFO] Business Manager .................................. SUCCESS [ 0.109 s]
[INFO] Core module ....................................... SUCCESS [ 6.699 s]
[INFO] Booter Application ................................ SUCCESS [ 1.016 s]
[INFO] Booter Service Webapp ............................. FAILURE [ 33.289 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 49.099 s
[INFO] Finished at: 2015-08-09T16:09:15+05:30
[INFO] Final Memory: 21M/121M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project service-manager: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/deploy?path=%2Fservice-manager&war= -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project service-manager: Cannot invoke Tomcat manager
答案 0 :(得分:0)
我认为网址应为http://localhost:8080/manager/text
(您错过了/ text)。
答案 1 :(得分:0)
我有同样的行为,也许你正试图调用错误的maven目标。
首先确保根据Tomcat conf/tomcat-users.xml
配置通知您的用户名和密码。
其次,如果要在Tomcat 6上进行部署,请尝试使用tomcat6:deploy
或tomcat6:redeploy
目标(而不是tomcat:deploy)。为我工作。
一些建议:
warFile
属性,您是否正在使用它,因为目标文件夹上存在多次战争?如果没有,则无需指定它。