Maven tomcat7 自动部署。。

落爺英雄遲暮 提交于 2020-04-07 08:42:00
  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.成功。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!