码迷,mamicode.com
首页 > 其他好文 > 详细

Maven自动部署war到Tomcat6

时间:2014-10-15 14:26:20      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:maven   tomcat   web   

Maven自动部署war到Tomcat

软件版本:tomcat6、maven3

1.  在maven项目的pom里配置如下信息

    <build>

        <finalName>spring_web</finalName>

        <plugins>

            <plugin>

                <groupId>org.codehaus.mojo</groupId>

                <artifactId>tomcat-maven-plugin</artifactId>

                <version>1.1</version>

                <configuration>

                    <url>http://localhost:8080/manager</url>

                    <username>admin</username>

                    <password>admin</password>

                    <path>/spring_web</path>

                </configuration>

                <executions>

                    <execution>

                        <id>tomcat-deploy</id>

                        <phase>deploy</phase>

                        <goals>

                            <goal>deploy</goal>

                        </goals>

                    </execution>

                </executions>

            </plugin>

        </plugins>

    </build>

2.  在Tomcat的tomcat-users.xml里添加下面的信息

    <rolerolename="manager"/>

    <userusername="admin" password="admin"roles="manager"/>

3.  启动Tomcat

 

4.  运行Maven build...

      bubuko.com,布布扣                         

 

5.  查看Tomcat的webapps下面的文件,看是否多了两个文件,其中有spring_web.war。

或是输入自己项目的url,比如像我的是http://localhost:8080/spring_web/

若出现则成功!

Maven自动部署war到Tomcat6

标签:maven   tomcat   web   

原文地址:http://blog.csdn.net/maskdfe/article/details/40108335

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!