您的位置:首页 > 其它

Maven常用插件

2013-03-20 15:51 225 查看


Maven常用插件

Maven常用插件

1) 通用

Xml代码



<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-compiler-plugin</artifactId>

<version>2.3.2</version>

<configuration>

<debug>true</debug>

<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) 打包

Xml代码



<!-- mvn war:war -->

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-war-plugin</artifactId>

<version>2.2</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) 部署

Xml代码



<!-- 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

Xml代码



<plugin>

<groupId>org.mortbay.jetty</groupId>

<artifactId>maven-jetty-plugin</artifactId>

<version>6.1.26</version>

<configuration>

<scanIntervalSeconds>20</scanIntervalSeconds>

<stopKey>foo</stopKey>

<stopPort>9999</stopPort>

<connectors>

<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">

<port>8080</port>

<maxIdleTime>60000</maxIdleTime>

</connector>

<connector implementation="org.mortbay.jetty.security.SslSocketConnector">

<port>8443</port>

<maxIdleTime>60000</maxIdleTime>

<keystore>C:/Documents and Settings/zhuoying/.keystore</keystore>

<password>yingzhor@163.com</password>

<keyPassword>yingzhor@163.com</keyPassword>

</connector>

</connectors>

</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>

<dependencies>

<dependency>

<groupId>org.mortbay.jetty</groupId>

<artifactId>jetty-sslengine</artifactId>

<version>6.1.26</version>

</dependency>

</dependencies>

</plugin>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: