1修改tomcat的apache-tomcat-7.0.81\conf\tomcat-users.xml文件


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

说明:username=”user” password=”password”是访问http://IP:port/manager/html的用户名密码
这里写图片描述

这里写图片描述

这里写图片描述

这里写图片描述

正式项目上线都放在root上。
2:pom的插件

<plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <!--tomcat 热部署,将项目发布到IP:PORT的tomcat下 -->
                    <url>http://IP:PORT/manager/text</url>
                    <!-- 发布到root下 ,path发布路径-->
                    <path>/</path>
                    <!-- <server>tomcat</server> -->
                    <username>xiniu</username>
                    <password>xiniu</password>
                </configuration>
            </plugin>

3发布
重发布命令:tomcat7:redeploy
这就把我们的工程发布到Root下,覆盖tomcat自带的工程.
如果使用命令:tomcat7:deploy,并且项目发布到/目录下,那么会报错,因为tomcat/目录自带项目。

这里写图片描述

4查看(可以访问了)
这里写图片描述
这里写图片描述

posted on 2017-09-21 14:57  2637282556  阅读(168)  评论(0编辑  收藏  举报