Maven tomcat7 自动部署。。

  1. pom.xml【web工程】

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>tian</groupId>
  <artifactId>TestMaven</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>TestMaven Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>  
            <plugin>  
            <groupId>org.apache.tomcat.maven</groupId>  
    		<artifactId>tomcat7-maven-plugin</artifactId>  
    		<version>2.1</version>  
            <configuration>  
                <url>http://localhost:8080/manager/text</url>  
                <server>localhost</server>
                <username>admin</username>  
                <password>admin</password>  
                <path>/TestMaven</path>  
            </configuration>  
       </plugin>  
        </plugins>  
  </build>
</project>

2.setting.xml【Maven】

 <server>
      <id>localhost</id>
      <username>admin</username>
      <password>admin</password>
    </server>

3.tomcat-users.xml【tomcat】

<role rolename="admin-gui"/>
    <role rolename="admin-script"/>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-status"/>
    <user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/> <role rolename="manager-jmx"/> <role rolename="manager-status"/>

4.启动tomcat

5.在eclipse或者命令行运行:tomcat7:deploy

6.成功。

你可能感兴趣的:(Maven tomcat7 自动部署。。)