Maven 常用插件

前言

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<plugin>
<groupId>org.basepom.maven</groupId>
<artifactId>duplicate-finder-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<useDefaultResourceIgnoreList>true</useDefaultResourceIgnoreList>
<!-- 忽略不检查的资源 -->
<ignoredResourcePatterns>
<ignoredResourcePattern>.*\.txt</ignoredResourcePattern>
<ignoredResourcePattern>.*\.properties</ignoredResourcePattern>
<ignoredResourcePattern>.*\.xml</ignoredResourcePattern>
</ignoredResourcePatterns>
<!-- fail fast after find duplicate class -->
<!--<failBuildInCaseOfConflict>true</failBuildInCaseOfConflict>-->
<ignoredDependencies>
<!-- 不需要校验的依赖项 -->
<!--<dependency>-->
<!--<groupId>com.sm.uc</groupId>-->
<!--<artifactId>uc-rpc</artifactId>-->
<!--</dependency>-->
</ignoredDependencies>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

Maven Release plugin

使用示例
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<project>
...
<scm>
<developerConnection>scm:svn:https://svn.mycompany.com/repos/myapplication/trunk/mycomponent/</developerConnection>
<!-- developerConnection: -->
</scm>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
</plugins>
...
</build>
...
</project>
Goal Description
release:branch Branch a project in SCM, using the same steps as the release:prepare goal, creating a branch instead of a tag. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/branch.html.
release:clean Clean up after a release preparation. This is done automatically after a successful release:perform, so is best served for cleaning up a failed or abandoned release, or a dry run. Note that only the working copy is cleaned up, no previous steps are rolled back. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/clean-release.html.
release:help Display help information on maven-release-plugin. Call mvn release:help -Ddetail=true -Dgoal= to display parameter details.
release:perform Perform a release from SCM, either from a specified tag, or the tag representing the previous release in the working copy created by release:prepare. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/perform-release.html.
release:prepare Prepare for a release in SCM. Steps through several phases to ensure the POM is ready to be released and then prepares SCM to eventually contain a tagged version of the release and a record in the local copy of the parameters used. This can be followed by a call to
release:perform. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/prepare-release.html.
release:prepare-with-pom Prepare for a release in SCM, fully resolving dependencies for the purpose of producing a “release POM”.
release:rollback Rollback changes made by a previous release. This requires that the previous release descriptor release.properties is still available in the local working copy. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/rollback-release.html.
release:stage Perform a release from SCM to a staging repository. If no goals are given, these default to deploy or deploy site:stage-deploy, if the project has a / element. If the goals contain site-deploy or site:deploy, these are overridden with site:stage-deploy.
release:update-versions Update the POM versions for a project. This performs the normal version updates of the release:prepare goal without making other modifications to the SCM such as tagging. For more info see http://maven.apache.org/plugins/maven-release-plugin/examples/update-versions.html.