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
You you're using tomcat 7, you should leave your plugin configuration in pom.xml like this:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/html</url>
<server>tomcat</server>
<path>/finance</path>
</configuration>
</plugin>
I have tried with the version configuration, like above example, but it didn't work for me. In settings.xml shoud have the configuration of the server, matching with the value in the pom.xml
<settings>
<servers>
<server>
<id>tomcat</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
</settings>
So, mvn tomcat:deploy or mvn tomcat:redeploy (if you have deployed the app already), or mvn tomcat:run (with tomcat down) should work.
If you use Tomcat 7 you need to refer to the url http://localhost:8080/manager/html in the tomcat plugin.
http://mojo.codehaus.org/tomcat-maven-plugin/examples/deployment-tomcat7.html
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.2-SNAPSHOT</version>
<configuration>
<url>http://localhost:8080/manager/html</url>
</configuration>
</plugin>
You only have to add the manager-script and manager roles to your tomcat user in tomcat-users.xml in config folder. In Tomcat 7 you have to specify different roles for different manager GUI access which in this case goes to text. At the end for text interface you have to use a manager-script role.
you just have to change the url by adding the "/html" so it will be like this http://localhost:8080/manager/html and bingo it works Hope that help
I have spent over three days on Server returned HTTP response code: 400 while trying to deploy web application onto Tomcat Server 8.0 bundled with Netbeans. When I used mvn tomcat7:deploy
over command line, everything worked perfect, but no success through Netbeans IDE. I have set tomcat maven plugin in POM.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>tomcat</server>
</configuration>
</plugin>
plus server record in .m2/conf/settings.xml for Maven,
<settings>
<servers>
<server>
<id>tomcat</id>
<username>admin</username>
<password>admin</password>
</server>
</servers>
</settings>
even appropriate tomcat user in tomcat-users.xml
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<user username="tomcat" password="tomcat" roles="manager-script,manager-gui"/>
but still without success. The root cause was Proxy server used in our company and Netbeans settings. In Netbeans, go to Tools -> Options and on General tab, use Manual Proxy Settings instead of System Proxy Settings (even if System Proxy Settings works). It helped me and now I am able to deploy web app on Tomcat 8 from Netbeans directly. You can also set No Proxy when you are using only localhost server. Root cause for my trouble was bad proxy set in default web browser, which is the source for option System Proxy Settings.
The /manager
application is by default secured by username/password. If you enter http://localhost:8080/manager you will be asked to provide security credentials as well. First create/enable user in Tomcat: after canceling or few unsuccessful attempts Tomcat will provide help on error screen. Then use these credentials in tomcat-maven-plugin
as explained here:
Add a plugin configuration block to your pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<server>myserver</server>
</configuration>
</plugin>
Add a corresponding server block to your settings.xml:
<server>
<id>myserver</id>
<username>myusername</username>
<password>mypassword</password>
</server>