欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

eclipse 部署maven到tomcat

程序员文章站 2024-01-13 15:10:58
...
1、Tomcat6,tomcat-users.xml
 <role rolename="manager-gui"/>
<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"/>
<user username="tomcat" password="tomcat" roles="manager-gui"/>
保证
http://localhost:8080/manager/deploy不会返回403

2、pom.xml
 <build>
    <finalName>ssm-web2</finalName>
    <plugins>
        <plugin>
            <!-- 3个可用插件 -->
          <groupId>org.apache.tomcat.maven</groupId>
          <artifactId>tomcat6-maven-plugin</artifactId>                    <!-- 命令为tomcat6:redeploy -->
          <!-- <groupId>org.apache.tomcat.maven</groupId> -->
          <!-- <artifactId>tomcat7-maven-plugin</artifactId> -->    <!-- 命令为tomcat7:redeploy -->
         <!-- <groupId>org.codehaus.mojo</groupId> -->
         <!-- <artifactId>tomcat-maven-plugin</artifactId> -->        <!-- 命令为tomcat:redeploy -->
         <!-- <version>2.2</version> -->
       <configuration>
           <url>http://localhost:8080/manager</url>           <!-- tomcat6部署管理路径 -->
          <!--<url>http://localhost:8080/manager/text</url>               tomcat7部署管理路径 -->
           <username>admin</username>                                <!-- tomcat的管理员账号 -->
           <password>admin</password>
           <port>8080</port>
           <path>/ssm-web2</path>                            <!-- 部署路径 -->
           <charset>UTF-8</charset>
           <encoding>UTF-8</encoding>
          <!-- 运行redeploy命令前,要能正常访问http://localhost:8080/manager-->
       </configuration>
       </plugin>
   </plugins>
  </build>