Publish the project through maven's tomcat plugin
use tomcat:deploy for the first release use tomcat:redeploy after the second
1, the configuration of pom.xml
Configure under properties
<webapp.contextPath.test>/delaydoc</webapp.contextPath.test>
<webapp.port.test>80</webapp.port.test>
<tomcat.server.test>test-server-tomcat</tomcat.server.test>
<tomcat.manager.test>http://tools.winupon.tst/manager/text</tomcat.manager.test>
<tomcat.uriEncoding.test>UTF-8</tomcat.uriEncoding.test>
ps:
1.1, delaydoc refers to the published folder (project name). After publishing, http://tools.winupon.tst/delaydoc can be accessed
1.2, test-server-tomcat is the tomcat user id configured under settings.xml under .m2
<!-- Tomcat hot deployment manager account -->
<servers>
<server>
<id>test-server-tomcat</id>
<username>manager</username>
<password>zdsoft</password>
</server>
</servers>
1.3, http://tools.winupon.tst/manager/text is the tomcat management user access path
2, tomcat configuration plugin
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
<fork>true</fork>
<debug>true</debug>
<optimize>true</optimize>
<failonerror>true</failonerror>
<deprecation>true</deprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<archive>
<manifest>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
</manifest>
<manifestEntries>
<Implementation-Qualifier>${package.qualifier}</Implementation-Qualifier>
<Implementation-Timestamp>${BUILD_ID}</Implementation-Timestamp>
<Implementation-Revision>r${SVN_REVISION}</Implementation-Revision>
</manifestEntries>
</archive>
<webResources>
<resource>
<directory>src/main/resources</directory>
<targetPath>WEB-INF/classes</targetPath>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>${webapp.contextPath.test}</path>
<port>${webapp.port.test}</port>
<urlEncoding>UTF-8</urlEncoding>
<server>${tomcat.server.test}</server>
<url>${tomcat.manager.test}</url>
<uriEncoding>${tomcat.uriEncoding.test}</uriEncoding>
</configuration>
</plugin>
ps: <directory>src/main/resources</directory> is the path to package and copy files. Sometimes the configuration of src/main/resources/${package.environment} will appear. The effect is the same: copy the files under src/main/resources/${package.environment} together