When I use mvn tomcat:deploy of tomcat-maven-plugin there is a 403 error:
Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.0:deploy (default-cli) on pr
This solution is for "Apache" Tomcat7 plugin: As it is already mentioned before you need to add "/text" to the end of the url
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<port>8080</port>
<path>/deployPath</path>
<url>http://localhost:8080/manager/text</url>
<server>TomcatServer</server>
</configuration>
Configure you "settings.xml" which is located inside .m2 folder
<servers>
<server>
<id>TomcatServer</id>
<username>script-admin</username>
<password>password</password>
</server>
</servers>
Since you use Tomcat 7, the MOST important thing is that you should create a different user for "manager-script" role, as it is mentioned in the documentation!
<role rolename="manager-script"/>
<user username="tomcat" password="password" roles="manager-script"/>
you should use /text:
http://localhost:8080/manager/text
and also add to user role manager-script
I used to get the same error, you just have to make sure that tomcat-users.xml file contain the user (admin in my case) with roles as (manager, manager-gui, admin, manager-script).
I have tomcat 7, maven 3 on ubuntu.
Passing from tomcat6 to tomcat7 recap:
Change plugin version
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
Change the option tomcat:deploy with tomcat7:deploy
May be you should check your configuration file in ~/.m2/settings.xml this file have to be with the follow struct :
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository/>
<interactiveMode/>
<usePluginRegistry/>
<offline/>
<pluginGroups/>
<servers/>
<mirrors/>
<proxies/>
<profiles/>
<activeProfiles/>
</settings>
After that you should to be sure that your server conf is correct for your project, instance of:
<servers>
<server>
<id>mytomcat</id>
<username>test</username>
<password>test</password>
</server>
</servers>
later run mvn tomcat:deploy. Remember that also you could run tomcat:deploy -X for see the debbug.
If you are using Eclipse with the plugin m2eclipse and you still have this error after trying these solutions, it could be because this plugin has not the manager included. You should download Tomcat separately and configure Eclipse to use it (check this link: tomcat-maven-plugin: Server returned HTTP response code: 403)