i am trying to do mvn tomcat:deploy and i came across with the error
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1
The following way works for me.
Please change your pom.xml
to include
<project>
...
<build>
<plugins>
....
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.1</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>my-tomcat</server>
<path>/myapp</path>
</configuration>
</plugin>
</plugins>
...
</build>
...
</project>
Make sure your Tomcat 7 server have the following lines on TOMCAT_HOME/conf/tomcat-users.xml
:
<!-- Role to manage WAR files via HTML /manager. The name should be as is! -->
<role rolename="manager-gui"/>
<!-- Role to manage WAR files via script like Maven. The name should be as is! -->
<role rolename="manager-script"/>
<!-- One user cannot have manager-gui and manager-script roles -->
<user username="managerGui" password="managerPwd" roles="manager-gui"/>
<user username="manager" password="managerPwd" roles="manager-script"/>
Configure your USER_HOME/.m2/settings.xml
to include the password.
<settings>
...
<servers>
...
<server>
<id>my-tomcat</id>
<username>manager</username>
<password>managerPwd</password>
</server>
</servers>
</settings>
Deploy using mvn tomcat7:redeploy
Read more on http://tomcat.apache.org/tomcat-7.0-doc/manager-howto.html
In my case solution worked. I did one petty mistake of not starting Apache Tomcat Server.
Apart from this, make user that you do appropriate entry in maven/conf/setting.xml within tag:-
<server>
<id>TomcatServer</id>
<username>admin</username>
<password>password</password>
</server>
In Apache Tomcat 7 tomcat-users.xml, following line should be added within
<tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="admin" password="password" roles="standard,manager,admin,manager-gui,manager-script,tomcat" />
In Pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8888/manager/text</url>
<server>TomcatServer</server>
<path>$ReplaceWithWarFileName$</path>
<update>true</update>
<username>admin</username>
<password>password</password>
</configuration>
</plugin>
A solution which worked in my case is:
First you must be aware of the move of the tomcat-maven-plugin to the apache software foundation Second you shouldn't put configuration stuff into maven/conf/settings.xml you should use the users settings.xml file HOME/.m2/settings.xml instead.
Apart from the above you should use the following URL for accessing Tomcat:
http://localhost:8080/manager/html
A solution that worked for me was in the Run options :
1_ Maven Install
2_ Maven Build