"Reprint" The MAVEN project in Eclipse deployed to Tomcat

Source: Internet
Author: User

In fact, the MAVEN project deployed to Tomcat many ways, I from the beginning of the war package to the Tomcat/webapps directory, to use the Tomcat-maven plug-in, to the direct use of servers deployment, all the way to go through a lot of detours.

Here are a few of these deployment options:

1. Fight the war package to the Tomcat/webapps directory

This is not the same as the non-MAVEN project, but the way it's packaged

The war package is then generated under the target directory, and is replicated to the Tomcat/webapps directory to complete the deployment.

2. Using the Tomcat-maven plugin, add the following code to the </dependencies> after Pom.xml and make the appropriate changes

 1 <build> 2 <finalName>guoguo-maven-web</finalName> 3 <plugins> 4 <plugin> 5 <!--3 Available plugins--6 <groupId>org.apache.tomcat.maven</groupId> 7 <artifacti d>tomcat6-maven-plugin</artifactid> <!--commands Tomcat6:redeploy-8 <!--<g Roupid>org.apache.tomcat.maven</groupid>-9 <!--<artifactid>tomcat7-maven-plugin</arti  Factid>-<!--command for Tomcat7:redeploy-->10 <!--<groupId>org.codehaus.mojo</groupId> -->11 <!--<artifactId>tomcat-maven-plugin</artifactId>-<!--command for Tomcat:redeplo Y-->12 <!--<version>2.2</version>-->13 <configuration>14 <!--&lt ;url>http://localhost:8080/manager</url>-<!--TOMCAT6 Deployment management path--&GT;15 &LT;URL&GT;HT Tp://localhost:8080/manaGer/text</url> <!--TOMCAT7 Deployment management path--&GT;16 <username>admin</username> <!--tomcat Administrator account-->17 <password>admin</password>18 <po Rt>8080</port>19 <path>/guoguo-maven-web</path> <!--deployment path--& Gt;20 <charset>utf-8</charset>21 <encoding>utf-8</encoding>22 <!- -Before running the redeploy command, the http://localhost:8080/manager-->23 </configuration>24 </plugin>25 </can be accessed normally Plugins>26 </build>

This configures the Tomcat Maven plugin

Before running the redeploy command, start Tomcat and have access to the Http://localhost:8080/manager

With the project right-click Run as--and Maven build ...--and fill in the Tomcat6:redeploy command in goals, the deployment succeeds, which sometimes causes Tomcat to make an error, and the need to restart Tomcat

3. Deploy directly using servers

First make sure the build configuration is OK

Test directory compiled to Target/test-classes, other compiled to the Target/classes directory, other general default does not need to change what

Then deploy the configuration:

Once configured, by right-clicking Servers in Tomcat,add and remove ... Add Items and restart Tomcat

The first one I don't have anymore, the second is for direct deployment to the test server, and the third is for local debugging

Appendix:

Tomcat administrator configuration, add the following configuration in the Tomcat-users.xml of the servers project, if you are using Bin/startup.bat to start Tomcat directly, modify the Conf/tomcat-users.xml

----------TOMCAT6 Administrator Configuration----------
<role rolename= "Manager"/>
<user username= "admin" password= "admin" roles= "manager"/>
----------TOMCAT6 Administrator Configuration----------

----------TOMCAT7 Administrator Configuration----------
<role rolename= "Manager-script"/>
<role rolename= "Manager-gui"/>
<user username= "admin" password= "admin" roles= "Manager-gui,manager-script"/>
----------TOMCAT7 Administrator Configuration----------

"Reprint" The MAVEN project in Eclipse deployed to Tomcat

Related Article

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.