首页 > 代码库 > maven 部署 tomcat

maven 部署 tomcat

  1. 确保maven 在eclipse配置好了

  2. poix.xml

<build>
  <finalName>zs</finalName>
  <plugins>
   <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.1</version>
    <configuration>
     <path>/test</path>
     <url>http://localhost:8080/manager/text</url>
     <server>tomcat</server>
     <username>admin</username>
     <password>admin</password>
     <path>/zs</path>
     <update>true</update>
    </configuration>
   </plugin>
<!--  <plugin> -->
<!--   <groupId>org.apache.maven.plugins</groupId> -->
<!--   <artifactId>maven-surfire-plugin</artifactId> -->
<!--   <version>2.12.4</version> -->
<!--   <configuration> -->
<!--    <testFailtureIgnore>true</testFailtureIgnore> -->
<!--   </configuration> -->
<!--  </plugin> -->
  </plugins>
 </build>

3.tomcat conf/tomcat-users.xml添加

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

4.maven settings.xml(可以是自定义settings.xml)

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

然后eclipse 中运行(前提是要tomcat先运行)

package tomat:redeploy

maven 部署 tomcat