在上篇文章中介绍了如何利用Artifactory搭建maven私服,接下来我们就要在自己的工程中配置常用的插件了
项目中常用到的插件有如下几个
<!-- 工程编码插件 -->
<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>
<!-- 生成javadoc插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<charset>UTF-8</charset>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- 打包java源码 -->
<plugin>
<artifactId>maven-source-plugin</artifactId>
<version>2.1.2</version>
<configuration>
<attach>true</attach>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 导入eclipse工程插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.7</version>
</plugin>
<!-- 利用maven的filter插件对资源文件中的${}变量进行替换
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- dependency插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.6</version>
<configuration>
<linkXref>true</linkXref>
<sourceEncoding>utf-8</sourceEncoding>
<minimumTokens>100</minimumTokens>
<targetJdk>1.6</targetJdk>
<rulesets>
<ruleset>check/pmd.xml</ruleset>
</rulesets>
</configuration>
</plugin>
<!-- 代码规范插件插件-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.8</version>
<configuration>
<configLocation>check/checkstyle.xml</configLocation><!--这个是checkstyle规则文件的位置-->
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId><!--这个groupID和artifactoryId一定要对应对了,搞了一个多星期才发现-->
<version>1.2</version>
<configuration>
<filters><!--以下是要排除在外的包,用"+"加入要进行统计的包-->
<filter>-com.crazycoder2010.openplatform.showcase.*.webapp.action.*</filter>
<filter>-com.crazycoder2010.openplatform.showcase.webapp.action.*</filter>
<filter>-com.crazycoder2010.openplatform.showcase.webapp.interceptor.*</filter>
<filter>-com.crazycoder2010.openplatform.showcase.webapp.converter.*</filter>
</filters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
<!--执行单元测试插件,必须滴 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.6</version>
<configuration>
<argLine>-Xms256m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=128m</argLine>
<includes>
<include>com/crazycoder2010/**/*Test*.java</include>
</includes>
<printSummary>true</printSummary>
</configuration>
</plugin>
checkstyle的规则文件,点击这里下载