Use maven-enforcer-plugin to enforce Maven version
authorThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 20 Jan 2015 04:27:25 +0000 (23:27 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Tue, 20 Jan 2015 05:02:35 +0000 (00:02 -0500)
This patch removes the unnecessary declaration of <prerequisites>
section.

As discovered in the mailing list thread linked below the <prerequisites>
section to set a minimal Maven version is deprecated and actually does
not enforce the minimal version. If we need to enforce a minimal Maven
version we need to use the maven-enforcer-plugin instead.

https://lists.opendaylight.org/pipermail/discuss/2015-January/004309.html

Change-Id: I5e5ce1af34451b0bcda51ee10ee0c181bd85393b
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
distributions/karaf/pom.xml
distributions/pom.xml
distributions/test/pom.xml
features/pom.xml
pom.xml

index a598f5e6bc439b0ff60616a52d472c52a05fdbe8..8cb0172fe9f140275e322a98215911120ba0448f 100644 (file)
@@ -9,9 +9,7 @@
    </parent>
   <artifactId>distribution-karaf</artifactId>
   <packaging>pom</packaging>
-  <prerequisites>
-    <maven>3.0</maven>
-  </prerequisites>
+
   <properties>
     <branding.version>1.1.0-SNAPSHOT</branding.version>
     <karaf.resources.version>1.5.0-SNAPSHOT</karaf.resources.version>
index 37c2eccafe37656da99e63fc95c6dbba0ae36dc9..c44303b1a58182ffe3316c649afe7d5027e31398 100644 (file)
@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <prerequisites>
-    <maven>3.0</maven>
-  </prerequisites>
   <parent>
     <groupId>org.opendaylight.integration</groupId>
     <artifactId>root</artifactId>
index 73cfeadfb39318d41b25bb92e243c955573f24f0..6f4d785b5b7bf3086ea8df461345379e860f30e4 100644 (file)
@@ -9,9 +9,7 @@
    </parent>
   <artifactId>distribution-test</artifactId>
   <packaging>pom</packaging>
-  <prerequisites>
-    <maven>3.0</maven>
-  </prerequisites>
+
   <properties>
     <branding.version>1.1.0-SNAPSHOT</branding.version>
     <karaf.resources.version>1.5.0-SNAPSHOT</karaf.resources.version>
index 18b2a6d46032f0f833c035e2e79ba685a70e4609..593523f11c81c60621d606f8257b6bf48f4f2e61 100644 (file)
@@ -17,9 +17,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <name>${project.artifactId}</name>
   <packaging>pom</packaging>
   <modelVersion>4.0.0</modelVersion>
-  <prerequisites>
-    <maven>3.1.1</maven>
-  </prerequisites>
+
   <modules>
     <module>index</module>
     <module>test</module>
diff --git a/pom.xml b/pom.xml
index 134d40c8a02d3835df1b3125a97919ceedddf5b8..d1dbbb5c9432cb49c0f6bb689e5d04ec76d65de5 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
-  <prerequisites>
-    <maven>3.0</maven>
-  </prerequisites>
   <groupId>org.opendaylight.integration</groupId>
   <artifactId>root</artifactId>
   <version>0.3.0-SNAPSHOT</version>
@@ -41,6 +38,7 @@
     <karaf.version>3.0.1</karaf.version>
     <maven.surefire.version>2.16</maven.surefire.version>
     <checkstyle.version>2.12</checkstyle.version>
+    <enforcer.version>1.3.1</enforcer.version>
   </properties>
   <modules>
     <module>distributions/</module>
         </plugin>
       </plugins>
     </pluginManagement>
+
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>${enforcer.version}</version>
+        <executions>
+          <execution>
+            <id>enforce-maven</id>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <requireMavenVersion>
+                  <version>3.1.1</version>
+                </requireMavenVersion>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
   </build>
 </project>