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