【发布时间】:2011-11-22 23:40:29
【问题描述】:
POM.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>myserver</server>
<path>/test</path>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
</configuration>
</plugin>
使用的 Eclipse: 带有 m2e 插件的 Eclipse indigo 3.7
修改 Tomcat7/conf/tomcat-users.xml
<role rolename="admin"/>
<role rolename="manager"/>
<user username="admin" password="admin" roles="admin,manager"/>
</tomcat-users>
Context.xml
Tomcat7/conf/context.xml,将<context>改为
<Context antiJARLocking="true" antiResourceLocking="true">
在apache-maven\conf\settings.xml
下在服务器标签下添加以下条目:
<servers>
<server>
<id>myserver</id>
<username>admin</username>
<password>admin</password>
</server>
启动 tomcat 服务器。
target 运行:tomcat:deploy 和 tomcat:undeploy
出现以下错误:
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:redeploy (default-cli) on project test: Cannot invoke Tomcat manager: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/html/deploy?path=%2Ftest&war=&update=true -> [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
项目名称:测试
war 文件名:test-1.0-SNAPSHOT.war
发现了类似的问题,但没有得到太多用处:Tomcat-maven-plugin 401 error
【问题讨论】:
-
当您访问此 URL:
http://localhost:8080/manager/html时是否加载了页面?