1. 程式人生 > >IDEA 社群版整合TOMCAT

IDEA 社群版整合TOMCAT

直接在POM.XML中新增以下內容

<plugin>
    <groupId>org.apache.tomcat.maven</groupId>
    <artifactId>tomcat7-maven-plugin</artifactId>
    <version>2.2</version>
    <configuration>
        <port>8888</port>
        <path>/</path>
        <contextFile>src/main/webapp/META-INF/context.xml</contextFile>
    </configuration>
</plugin>

該外掛會自動下載一個嵌入式的TOMCAT,可以在configuration配置節裡面對這個嵌入式的TOMCAT配置埠,目錄和content.xml資訊。

要執行這個TOMCAT,需要在IDEA-RUN-DEBUG,editconfiguration,新增-MAVEN,名稱輸入TOMCAT7,commandline為:tomcat7:run

關於tomcat7-maven-plugin的官方資訊見:http://tomcat.apache.org/maven-plugin-trunk/tomcat7-maven-plugin/usage.html