首页 > 技术文章 > eclipse maven tomcat 部署

mmdsnb 2015-05-07 15:39 原文

1.tomcat-users.xml

ps:eclipse 中Servers 中的文件 

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

2.项目中的pom.xml

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <env>dev</env>
                <deploy.url>http://localhost:8080/manager/</deploy.url>
            </properties>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
        </profile>
        <profile>
            <id>test</id>
            <properties>
                <env>test</env>
            </properties>
        </profile>
        <profile>
            <id>product</id>
            <properties>
                <env>product</env>
            </properties>
        </profile>
    </profiles>

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

 

3.启动tomcat

4.命令行模式下

cd ${工程根目录}
mvn tomcat:redeploy

 

推荐阅读