Configuring Maven Tomcat Plugin (tomcat-maven-plugin)
terça-feira, 19 de maio de 2009 | | |This small tutorial will guide through the necessary steps to configure tomcat-maven-plugin.
This plugin will allow you to perform deploy tasks directly through maven. For more information about what tasks can be done by this plugin, please check http://mojo.codehaus.org/tomcat-maven-plugin/deployment.html
Open your POM.XML file and put the following code inside plugins section:
<plugins>
<plugin>
<groupid>org.codehaus.mojo</groupid>
<artifactid>tomcat-maven-plugin</artifactid>
<version>1.0-beta-1</version>
<configuration>
<server>tomcatNameYouPutInsideSettings.XML</server>
</configuration>
</plugin>
</plugins>
You may have noticed the tag
The settings.XML file is situated in the same place as your maven binary is.
Just go into your Maven binary directory and search for settings.XML, open it and insert the following code inside the tag <servers>...</servers> just as shown here:
<servers>
<server>
<id>tomcat6</id>
<username>tomcatUserAllowedToPerformDeployOperations</username>
<password>tomcatUserPassword</password>
</server>
</servers>
Please adapt the contents of <username> and <password> tags to what is appropriate for you.
Remember to also add the same user and password into your tomcat users file. The tomcat users file is located in tomcat path, subdirectory conf. The corresponding tomcat users file to the previous settings configurations would look like this:
<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
<role rolename="manager"/>
<user username="tomcatUserAllowedToPerformDeployOperations" password="tomcatUserPassword" roles="manager"/>
</tomcat-users>