maven tomcat配置


1、我的tomcat7  

  在config文件下修改tomcat-users.xml

tomcat-users.xml内容如下:


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

2maven config文件夹下修改setting.xml

<servers>
  <!-- 增加一个测试服务器 -->
  <server>
<id>tomcat</id>
<username>tomcat</username>
<password>tomcat</password>
</server>
  </servers>

这里的id在下面要用(和3中的service对应)


3、在你的项目的pom.xml文件中增加

 <build>
 <plugins>
  <plugin>
   <groupId>org.codehaus.mojo</groupId>
   <artifactId>tomcat-maven-plugin</artifactId>
   <version>1.1</version>
   <configuration>
    <url>http://127.0.0.1:8080/manager/text</url>
    <server>tomcat</server>
    <username>tomcat</username>
    <password>tomcat</password>
   </configuration>
  </plugin>
  </plugins>
   </build>

4.右击项目下的pom.xml 文件 Run as  -》 Maven build...          Golals选项填写 package tomcat:redeploy 点击run

 看到控制台输出

BUILD SUCCESS就成功了


(对了还有一点 你的tomcat需要先运行 在操作第四步)




猜你喜欢

转载自blog.csdn.net/loveme888/article/details/41957751
今日推荐