Maven自动发布到Tomcat
2016-08-03 本文已影响121人
Dingsf
maven settings.xml
<servers>
<server>
<id>nexus-releases</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>nexus-snapshots</id>
<username>admin</username>
<password>admin123</password>
</server>
<server>
<id>local_tomcat7</id>
<username>tomcat</username>
<password>tomcat1@3</password>
</server>
<server>
<id>local_tomcat8</id>
<username>tomcat</username>
<password>tomcat1@3</password>
</server>
<server>
<id>test_server</id>
<username>tomcat</username>
<password>tomcat1@3</password>
</server>
</servers>
maven项目pom.xml
<build>
<defaultGoal>install</defaultGoal>
<finalName>jxc</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<charset>UTF-8</charset>
<url>http://192.168.1.88:8083/manager/text</url>
<path>/jxc</path>
<server>test_server</server>
<uriEncoding>UTF-8</uriEncoding>
</configuration>
</plugin>
</plugins>
</build>
tomcat-users.xml
<role rolename="manager"/>
<role rolename="manager-script"/>
<role rolename="admin-gui"/>
<role rolename="manager-gui"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat" password="tomcat1@3" roles="manager,manager-gui,admin-gui,manager-script,manager-jmx,manager-s
tatus"/>