1、父pom.xml
<build> <pluginManagement> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.0.0.M0</version> <configuration> <scanIntervalSeconds>2</scanIntervalSeconds> <webAppConfig> <contextPath>/</contextPath> <!--<defaultsDescriptor>webdefault.xml</defaultsDescriptor>--> </webAppConfig> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>80</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <stopPort>9999</stopPort> <stopKey>jetty</stopKey> </configuration> </plugin> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>tomcat-maven-plugin</artifactId> <version>1.1</version> <configuration> <path>/</path> <port>80</port> <!--<uriEncoding>UTF-8</uriEncoding>--> <url>http://localhost:80/manager/html</url> <server>tomcat6</server> </configuration> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <executions> <execution> <phase>compile</phase> <goals> <goal>exploded</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> <useFile>false</useFile> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.6</source> <target>1.6</target> <encoding>UTF-8</encoding> <fork>true</fork> <meminitial>512m</meminitial> <maxmem>1048m</maxmem> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <encoding>UTF-8</encoding> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>attach-sources</id> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> <configuration> <appendAssemblyId>false</appendAssemblyId> <descriptors> <descriptor>package.xml</descriptor> </descriptors> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>assembly</goal> </goals> </execution> </executions> </plugin> </plugins> </pluginManagement> </build>
2、子pom.xml
<
build
>
<plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> </plugin>
<!-- tomcat配置--> <!--<plugin>--> <!--<groupId>org.apache.tomcat.maven</groupId>--> <!--<artifactId>tomcat6-maven-plugin</artifactId>--> <!--<configuration>--> <!--<path>/</path>--> <!--<port>8080</port>--> <!--<uriEncoding>UTF-8</uriEncoding>--> <!--<url>http://localhost:8080/manager/html</url>--> <!--<server>tomcat6</server>--> <!--</configuration>--> <!--</plugin>--> </plugins> </build>
3、启两个jetty
<build> <plugins> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-source-plugin</artifactId> </plugin> <plugin> <artifactId>maven-assembly-plugin</artifactId> </plugin> <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.0.0.M0</version> <configuration> <scanIntervalSeconds>2</scanIntervalSeconds> <webAppConfig> <contextPath>/</contextPath> <!--<defaultsDescriptor>webdefault.xml</defaultsDescriptor>--> </webAppConfig> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>81</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> <stopPort>9991</stopPort> <stopKey>jetty</stopKey> </configuration> </plugin> </plugins> </build>
转载于:https://www.cnblogs.com/excite/p/4829881.html