maven使用内嵌tomcat7


在web项目的pom.xml中添加如下:

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.1</version>
                <configuration>
                    <port>8080</port>
                    <path>/web</path>
                    <uriEncoding>UTF-8</uriEncoding>
                    <finalName>web</finalName>
                    <server>tomcat7</server>
                </configuration>
            </plugin>
        </plugins>
    </build>

然后项目右键--run as -- maven build -- 输入参数 tomcat7:run。需要的构件下载完成后即可通过http://localhost:8080/web访问项目

 

 该插件可以远程部署web项目,常用命令有:

命令 描述
tomcat7:deploy 部署一个web war包
tomcat7:reload 重新加载web war包

tomcat7:start

启动tomcat

tomcat7:stop

停止tomcat

tomcat7:undeploy

停止一个war包
tomcat7:run 启动嵌入式tomcat ,并运行当前项目


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM