The Maven Tomcat plugin is now mostly available in two versions, Tomcat-maven-plugin and Tomcat7-maven-plugin, in the same way, please look down.
Note: You first Configure the administrative users and permissions for Tomcat.
Open the Tomcat-users.xml file and add it later
<role rolename= "Manager-gui"/>
<role rolename= "Manager-script"/>
<user password= "123456" roles= "Manager-gui,manager-script" username= "admin"/>
Tomcat7-maven-plugin use
Configuration
Two plug-ins using the same method, the same need to reference the plug-in pom.xml, need to add the following configuration
<build>
<finalName>myproject</finalName>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://192.168.159.128/manager/text</url>
<path>/</path>
<server>tomcat</server>
<username>admin</username>
<password>123456</password>
</configuration>
</plugin>
</plugins>
</build>
Plug-in use
Briefly describe:
Path is the way to access the app
Port is the port number of Tomcat
Uriencoding URL by UTF-8 encoding, this solves the Chinese parameter garbled.
The Server specifies the tomcat name.
The configuration is so simple, basically fixed, below to see how to use.
Plugin Run
If eclipse installs the Maven plugin, select the project, right-click and select Run as--> maven build.
If this is the first time, the following dialog box will pop up. Add the following command to the Goals box: Tomcat:run
This will allow the Tomcat plug-in to run.
Here are a few common goal
Command |
Describe |
Tomcat:deploy |
Deploy a Web War package |
Tomcat:reload |
Reload the Web War package |
Tomcat:start |
Start Tomcat |
Tomcat:stop |
Stop Tomcat |
Tomcat:undeploy |
Stop a war package |
Tomcat:run |
Start embedded Tomcat and run the current project
|
Note here that the plug-in naming method is somewhat different, such as starting Tomcat, the corresponding target command is: Tomcat7:run, the others need to be changed to: TOMCAT7,
The configuration is so simple that if you need to trace the dubug in Tomcat, you can start the MAVEN command in the same way.
Eclipse-maven Integrated TOMCAT7 Thermal Deployment project