MAVEN Automation: Deploying projects to Tomcat

Source: Internet
Author: User

1. Configuring Users in Tomcat

Tomcat_home/conf/tomcat-users.xml the configuration file, add the following information:

|--Tomcat-users.xml

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

  <role rolename= "Manager-gui"/>  

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

2. Configuring Tomcat server information in Settings.xml

In the Maven_home/conf/settings.xml configuration file, add the following information

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


<servers> ...  <!--Configure the Tomcat server for the deployment project--<server>      <id>myserver</id>      < username>admin</username>      <password>admin</password>    </server>......</ Servers>


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


3. Configuring release information in the Pom.xml of the project

Add Project release information in the project management configuration file

|--need to be aware that Tomcat has done some updates here, and most of the online tutorials and information here have different problems. Please refer to the following:

Tomcat website Tip:

Since version 2.0-beta-1 Tomcat Mojos have been renamed to Tomcat6 and TOMCAT7 with the same goals.

You must configure your POM to use this new groupId:

Prior to the Tomcat release plugin, from the 2.0-beta-1 version, Tomcat Mojos was replaced with TOMCAT6/TOMCAT7, which must be configured in your project in the following way

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


<pluginManagement>      <plugins>        <!--configuration Tocmat6 plug-in-        <plugin>          <groupid >org.apache.tomcat.maven</groupId>          <artifactId>tomcat6-maven-plugin</artifactId>          <version>2.3-SNAPSHOT</version>        </plugin>
<!--configuring TOCMAT7 plugins--        <plugin>          <groupId>org.apache.tomcat.maven</groupId>          <artifactId>tomcat7-maven-plugin</artifactId>          <version>2.3-SNAPSHOT</version>        </plugin>      </plugins>    </pluginManagement>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Alternatively, you can configure the following information directly in the Maven_home/conf/settings.xml

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

<pluginGroups> ...    .    <pluginGroup>org.apache.tomcat.maven</pluginGroup> ...    .  </pluginGroups>

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


4. Project published in Maven

After Tomcat has updated the configuration, some of the commands for releasing the project have been adjusted accordingly.

|--Publishing a project

|--Unload Project

|--Startup Project

|--Stop Project

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Redeploying a WAR project "Publish Project"

The goals required to redeploy a WAR project depend upon how it was deployed:

    • To redeploy a WAR project deployed by Tomcat:deploy You can type: use Tomcat6/7:deploy to publish projects
      MVN Package Tomcat6/7:redeploy
    • To redeploy a WAR project deployed by tomcat:exploded you can type:
      MVN war:exploded Tomcat6/7:redeploy
    • To redeploy a WAR project deployed by Tomcat:inplace you can type:
      MVN War:inplace Tomcat6/7:redeploy
    • To redeploy a context.xml file deployed by Tomcat:deploy you can type:
      MVN Tomcat6/7:redeploy

      Note: Depending on the docBase specified in the context.xml if also need to call war:exploded or War:inplace as above.


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Undeploying a WAR project "uninstalling projects from the server"

To Undeploy a WAR from Tomcat you can type:

MVN Tomcat6/7:undeploy


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Starting a WAR project "Start a project"

To start a WAR in Tomcat you can type:

MVN Tomcat6:start

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Stopping a WAR project "Stop a Project"

To stop a WAR in Tomcat you can type:

MVN tomcat6:stop

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

In conclusion, I hope we can help you.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



MAVEN Automation: Deploying projects to Tomcat

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.