http://wiki.eclipse.org/Jetty/Feature/Jetty_Maven_Plugin
http://www.infoq.com/cn/news/2011/04/xxb-maven-7-plugin
http://www.infoq.com/cn/news/2011/05/xxb-maven-8-plugin
http://yingzhuo.iteye.com/blog/1185371
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-resources-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <encoding>UTF-8</encoding>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.9</version>
- <configuration>
- <skipTests>true</skipTests>
- <testFailureIgnore>flase</testFailureIgnore>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <outputDirectory>dependencies</outputDirectory>
- </configuration>
- </plugin>
2) 打包
- <!-- mvn war:war -->
- <plugin>
- <artifactId>maven-war-plugin</artifactId>
- <version>2.1.1</version>
- <configuration>
- <packagingExcludes>WEB-INF/web.xml</packagingExcludes>
- <webXml>WebContent/WEB-INF/web.xml</webXml>
- <outputDirectory>target</outputDirectory>
- <warName>client</warName>
- <warSourceDirectory>WebContent</warSourceDirectory>
- </configuration>
- </plugin>
- <!-- mvn jar:jar -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <excludes>
- <exclude>**/impl/*.class</exclude>
- </excludes>
- </configuration>
- </plugin>
- <!-- mvn source:jar -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-source-plugin</artifactId>
- <version>2.1.2</version>
- <configuration>
- <excludes>
- <exclude>**/impl/*.java</exclude>
- </excludes>
- </configuration>
- </plugin>
- <!-- mvn ejb:ejb -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-ejb-plugin</artifactId>
- <version>2.3</version>
- <configuration>
- <ejbVersion>3.0</ejbVersion>
- </configuration>
- </plugin>
3) 部署
- <!-- mvn package jboss:hard-undeploy jboss:hard-deploy -->
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-maven-plugin</artifactId>
- <version>1.5.0</version>
- <configuration>
- <jbossHome>D:\apps\jboss-5.1.0.GA</jbossHome>
- <serverName>default</serverName>
- <fileName>target/${project.artifactId}-${project.version}.jar</fileName>
- </configuration>
- <executions>
- <execution>
- <id>redeploy</id>
- <phase>install</phase>
- <goals>
- <goal>hard-undeploy</goal>
- <goal>hard-deploy</goal>
- </goals>
- </execution>
- <execution>
- <id>undeploy</id>
- <phase>clean</phase>
- <goals>
- <goal>hard-undeploy</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
4) Jetty
- <plugin>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>maven-jetty-plugin</artifactId>
- <version>6.1.10</version>
- <configuration>
- <scanIntervalSeconds>10</scanIntervalSeconds>
- <stopKey>foo</stopKey>
- <stopPort>9999</stopPort>
- </configuration>
- <executions>
- <execution>
- <id>start-jetty</id>
- <phase>pre-integration-test</phase>
- <goals>
- <goal>run</goal>
- </goals>
- <configuration>
- <scanIntervalSeconds>0</scanIntervalSeconds>
- <daemon>true</daemon>
- </configuration>
- </execution>
- <execution>
- <id>stop-jetty</id>
- <phase>post-integration-test</phase>
- <goals>
- <goal>stop</goal>
- </goals>
- </execution>
- </executions>
- </plugin>