无法执行mvn tomcat:deploy,因为http响应405 [英] cant do mvn tomcat:deploy because of http response 405
本文介绍了无法执行mvn tomcat:deploy,因为http响应405的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在将Tomcat 7作为Windows服务运行. 而且我想在我的项目根目录中部署mvn:tomcat.
I am running a Tomcat 7 as a windows service. And i want to do mvn:tomcat deploy in my projects root directory.
但是始终出现此错误,您能帮我解决这个问题吗?
But all the time this error appears, can you help me with this plz?
[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文件中包含以下部分:
I got the following section in my pom file:
<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>
推荐答案
要使它正常工作,需要做两件事.
Two things needed to get this to work;
- 在tomcat-users.xml中具有角色管理器脚本的tomcat用户
- 指定要部署到以manager/text结尾的URL.
就是这样.请参阅下面的pom.xml的示例conf.并且不要忘记使用tomcat7:redeploy,因此您不必循环取消部署/部署.
That's it. See example conf for pom.xml below. And don't forget to use tomcat7:redeploy so you don't have to cycle undeploy/deploy.
<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>
这篇关于无法执行mvn tomcat:deploy,因为http响应405的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文