Upgrade Maven versions in archetype

Henri Tremblay henri.tremblay at gmail.com
Wed Apr 23 22:42:20 UTC 2014


Hi,

While you are yak shaving, here is a patch for you.

It will prevent me from having to update my pom each time I generate a
benchmark.

It does:

   1. Add a test to the archetype (so now, when you do "mvn verify", it
   will generate and archetype and compile it)
   2. Add a required maven version at 3.0 since it is what is required
   3. Set the version of all implicit plugins by adding them in the plugin
   management
   4. Update to latest the shade and compiler plugin

To check the versions, I used the following plugin on the generated
archetype:
mvn versions:display-dependency-updates versions:display-plugin-updates

Regards,
Henri
-------------- next part --------------
# HG changeset patch
# User Henri Tremblay <henri at tremblay.pro>
# Date 1398292492 -7200
#      Thu Apr 24 00:34:52 2014 +0200
# Node ID 2e02567d28d67dde8c9ad3d9b297f509b8ec1f0c
# Parent  b4c138dc774ac90a40bac8c5f5f8e18c2c38c60f
Update plugins versions

diff -r b4c138dc774a -r 2e02567d28d6 jmh-archetypes/jmh-java-benchmark-archetype/src/main/resources/archetype-resources/pom.xml
--- a/jmh-archetypes/jmh-java-benchmark-archetype/src/main/resources/archetype-resources/pom.xml	Wed Apr 23 23:52:45 2014 +0400
+++ b/jmh-archetypes/jmh-java-benchmark-archetype/src/main/resources/archetype-resources/pom.xml	Thu Apr 24 00:34:52 2014 +0200
@@ -34,6 +34,10 @@
 
     <name>Auto-generated JMH benchmark</name>
 
+    <prerequisites>
+        <maven>3.0</maven>
+    </prerequisites>
+
     <dependencies>
         <dependency>
             <groupId>org.openjdk.jmh</groupId>
@@ -57,7 +61,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.0</version>
+                <version>3.1</version>
                 <configuration>
                     <compilerVersion>1.6</compilerVersion>
                     <source>1.6</source>
@@ -67,7 +71,7 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-shade-plugin</artifactId>
-                <version>2.0</version>
+                <version>2.2</version>
                 <executions>
                     <execution>
                         <phase>package</phase>
@@ -85,8 +89,47 @@
                     </execution>
                 </executions>
             </plugin>
-
         </plugins>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>2.5</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>2.8.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>2.5.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>2.4</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>2.9.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>2.6</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>3.3</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-source-plugin</artifactId>
+                    <version>2.2.1</version>
+                </plugin>
+                <plugin>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>2.17</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
     </build>
 
 </project>
diff -r b4c138dc774a -r 2e02567d28d6 jmh-archetypes/jmh-java-benchmark-archetype/src/test/resources/projects/test/archetype.properties
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-archetypes/jmh-java-benchmark-archetype/src/test/resources/projects/test/archetype.properties	Thu Apr 24 00:34:52 2014 +0200
@@ -0,0 +1,4 @@
+groupId=org.openjdk.jmh
+artifactId=jmh-java-benchmark-archetype-test
+version=1.0-SNAPSHOT
+package=org.openjdk.jmh
diff -r b4c138dc774a -r 2e02567d28d6 jmh-archetypes/jmh-java-benchmark-archetype/src/test/resources/projects/test/goal.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jmh-archetypes/jmh-java-benchmark-archetype/src/test/resources/projects/test/goal.txt	Thu Apr 24 00:34:52 2014 +0200
@@ -0,0 +1,1 @@
+verify
\ No newline at end of file


More information about the jmh-dev mailing list