1. 程式人生 > >IDEA pom檔案中配置Tomcat和jetty外掛

IDEA pom檔案中配置Tomcat和jetty外掛

1.配置Tomcat

    在pom檔案中的<build><plugins>中配置:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <server>tomcat7</server>
                <!--<path>/ads</path>-->
                <port>8080</port>
                <uriEncoding>UTF-8</uriEncoding>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>
    </plugins>
</build>

2.配置jetty

<build>
    <plugins>
        <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.26</version>
        <configuration>
          <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>
          <scanIntervalSeconds>3</scanIntervalSeconds>
          <contextPath>/</contextPath>
          <connectors>
            <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
              <port>8080</port>
            </connector>
          </connectors>
        </configuration>
      </plugin>
    </plugins>
</build>
配置完就可以在idea的Maven Projects中使用了