我正在将 Tomcat 7 作为 Windows 服务运行。
我想在我的项目根目录中进行 mvn:tomcat 部署。
但总是出现这个错误,你能帮我解决这个问题吗?
[INFO] Deploying war to http://localhost:8080/opendata
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.493s
[INFO] Finished at: Sun Jan 20 18:48:30 CET 2013
[INFO] Final Memory: 15M/39M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy
(default-cli) on project opendata: Cannot invoke Tomcat manager: Server returned
HTTP response code: 405 for URL: http://localhost:8080/manager/deploy?path=%2Fo
pendata&war= -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionE
xception
我的 pom 文件中有以下部分:
<build>
<finalName>opendata</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>myserver</server>
</configuration>
<version>1.1</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
要使其发挥作用,需要做两件事:
- 具有 tomcat-users.xml 中角色管理器脚本的 tomcat 用户
- 指定部署到以 manager/text 结尾的 URL。
就是这样。请参阅下面的 pom.xml 示例 conf。并且不要忘记使用 tomcat7:redeploy,这样您就不必循环取消部署/部署。
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://your-server:8080/manager/text</url>
<username>a-username</username>
<password>a-password</password>
<path>/a-path</path>
</configuration>
</plugin>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)