1f0da8
From d8356a58efde0808cabede14b4f1b2473fa73170 Mon Sep 17 00:00:00 2001
1f0da8
From: Mikolaj Izdebski <mizdebsk@redhat.com>
1f0da8
Date: Tue, 31 May 2016 10:52:12 +0200
1f0da8
Subject: [PATCH 2/2] Port to maven-jar-plugin 3.0.0
1f0da8
1f0da8
---
1f0da8
 pom.xml                                            | 47 +++++-----------------
1f0da8
 .../logging/pathable/ChildFirstTestCase.java       |  8 ++--
1f0da8
 .../logging/pathable/ParentFirstTestCase.java      |  8 ++--
1f0da8
 3 files changed, 17 insertions(+), 46 deletions(-)
1f0da8
1f0da8
diff --git a/pom.xml b/pom.xml
1f0da8
index 5707595..c5d8d37 100644
1f0da8
--- a/pom.xml
1f0da8
+++ b/pom.xml
1f0da8
@@ -237,6 +237,10 @@ under the License.
1f0da8
         <artifactId>maven-jar-plugin</artifactId>
1f0da8
         <executions>
1f0da8
           <execution>
1f0da8
+	    <id>default-jar</id>
1f0da8
+	    <phase>skip</phase>
1f0da8
+	  </execution>
1f0da8
+	  <execution>
1f0da8
             
1f0da8
               - The custom test framework requires the unit test code to be
1f0da8
               - in a jarfile so it can control its place in the classpath.
1f0da8
@@ -261,7 +265,7 @@ under the License.
1f0da8
               <goal>jar</goal>
1f0da8
             </goals>
1f0da8
             <configuration>
1f0da8
-              <jarName>${project.artifactId}-api-${project.version}</jarName>
1f0da8
+              <classifier>api</classifier>
1f0da8
               <archive>
1f0da8
                 <manifestFile>${project.build.directory}/osgi-api/MANIFEST.MF</manifestFile>
1f0da8
               </archive>
1f0da8
@@ -288,7 +292,7 @@ under the License.
1f0da8
               <goal>jar</goal>
1f0da8
             </goals>
1f0da8
             <configuration>
1f0da8
-              <jarName>${project.artifactId}-adapters-${project.version}</jarName>
1f0da8
+              <classifier>adapters</classifier>
1f0da8
               <archive>
1f0da8
                 <manifestFile>${project.build.directory}/osgi-adapters/MANIFEST.MF</manifestFile>
1f0da8
               </archive>
1f0da8
@@ -346,39 +350,6 @@ under the License.
1f0da8
 
1f0da8
       <plugin>
1f0da8
         
1f0da8
-          - Attach the adapters and api jars to the normal artifact. This way
1f0da8
-          - they will be deployed when the normal artifact is deployed.
1f0da8
-          -->
1f0da8
-        <groupId>org.codehaus.mojo</groupId>
1f0da8
-        <artifactId>build-helper-maven-plugin</artifactId>
1f0da8
-        <version>1.0</version>
1f0da8
-        <executions>
1f0da8
-          <execution>
1f0da8
-            <id>attach-artifacts</id>
1f0da8
-            <phase>package</phase>
1f0da8
-            <goals>
1f0da8
-              <goal>attach-artifact</goal>
1f0da8
-            </goals>
1f0da8
-            <configuration>
1f0da8
-              <artifacts>
1f0da8
-                <artifact>
1f0da8
-                  <file>${project.build.directory}/${project.artifactId}-adapters-${project.version}.jar</file>
1f0da8
-                  <type>jar</type>
1f0da8
-                  <classifier>adapters</classifier>
1f0da8
-                </artifact>
1f0da8
-                <artifact>
1f0da8
-                  <file>${project.build.directory}/${project.artifactId}-api-${project.version}.jar</file>
1f0da8
-                  <type>jar</type>
1f0da8
-                  <classifier>api</classifier>
1f0da8
-                </artifact>
1f0da8
-              </artifacts>
1f0da8
-            </configuration>
1f0da8
-          </execution>
1f0da8
-        </executions>
1f0da8
-      </plugin>
1f0da8
-
1f0da8
-      <plugin>
1f0da8
-        
1f0da8
           - Many of JCL's tests use tricky techniques to place the generated
1f0da8
           - JCL jarfiles on the classpath in various configurations. This means
1f0da8
           - that those tests must be run *after* the "package" build phase.
1f0da8
@@ -442,9 +413,9 @@ under the License.
1f0da8
                   <logkit>${logkit:logkit:jar}</logkit>
1f0da8
                   <servlet-api>${javax.servlet:servlet-api:jar}</servlet-api>
1f0da8
                   <commons-logging>target/${project.build.finalName}.jar</commons-logging>
1f0da8
-                  <commons-logging-api>target/${project.artifactId}-api-${project.version}.jar</commons-logging-api>
1f0da8
-                  <commons-logging-adapters>target/${project.artifactId}-adapters-${project.version}.jar</commons-logging-adapters>
1f0da8
-                  <testclasses>target/commons-logging-tests.jar</testclasses>
1f0da8
+                  <commons-logging-api>target/${project.artifactId}-${project.version}-api.jar</commons-logging-api>
1f0da8
+                  <commons-logging-adapters>target/${project.artifactId}-${project.version}-adapters.jar</commons-logging-adapters>
1f0da8
+                  <testclasses>target/commons-logging-${project.version}-tests.jar</testclasses>
1f0da8
               </systemPropertyVariables>
1f0da8
             </configuration>
1f0da8
           </execution>
1f0da8
diff --git a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
1f0da8
index 1aeb12d..eb67ec1 100644
1f0da8
--- a/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
1f0da8
+++ b/src/test/java/org/apache/commons/logging/pathable/ChildFirstTestCase.java
1f0da8
@@ -213,11 +213,11 @@ public class ChildFirstTestCase extends TestCase {
1f0da8
         // getResource where it is accessable to both classloaders. The one visible
1f0da8
         // to the child should be returned. The URL returned will be of form
1f0da8
         //  jar:file:/x/y.jar!path/to/resource. The filename part should include the jarname
1f0da8
-        // of form commons-logging-adapters-nnnn.jar, not commons-logging-nnnn.jar
1f0da8
+        // of form commons-logging-nnnn-adapters.jar, not commons-logging-nnnn.jar
1f0da8
         resource = childLoader.getResource("org/apache/commons/logging/impl/Log4JLogger.class");
1f0da8
         assertNotNull("Unable to locate Log4JLogger.class resource", resource);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                resource.toString().indexOf("/commons-logging-adapters-1.") > 0);
1f0da8
+                resource.toString().indexOf("/commons-logging-1.2-adapters.jar!") > 0);
1f0da8
     }
1f0da8
 
1f0da8
     /**
1f0da8
@@ -269,9 +269,9 @@ public class ChildFirstTestCase extends TestCase {
1f0da8
         urlsToStrings[1] = urls[1].toString();
1f0da8
         Arrays.sort(urlsToStrings);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                urlsToStrings[0].indexOf("/commons-logging-1.") > 0);
1f0da8
+                urlsToStrings[0].indexOf("/commons-logging-1.2-adapters.jar!") > 0);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                urlsToStrings[1].indexOf("/commons-logging-adapters-1.") > 0);
1f0da8
+                urlsToStrings[1].indexOf("/commons-logging-1.2.jar!") > 0);
1f0da8
     }
1f0da8
 
1f0da8
     /**
1f0da8
diff --git a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
1f0da8
index f9bf452..fc10c8e 100644
1f0da8
--- a/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
1f0da8
+++ b/src/test/java/org/apache/commons/logging/pathable/ParentFirstTestCase.java
1f0da8
@@ -210,11 +210,11 @@ public class ParentFirstTestCase extends TestCase {
1f0da8
         // getResource where it is accessable to both classloaders. The one visible
1f0da8
         // to the parent should be returned. The URL returned will be of form
1f0da8
         //  jar:file:/x/y.jar!path/to/resource. The filename part should include the jarname
1f0da8
-        // of form commons-logging-nnnn.jar, not commons-logging-adapters-nnnn.jar
1f0da8
+        // of form commons-logging-nnnn.jar, not commons-logging-nnnn-adapters.jar
1f0da8
         resource = childLoader.getResource("org/apache/commons/logging/impl/Log4JLogger.class");
1f0da8
         assertNotNull("Unable to locate Log4JLogger.class resource", resource);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                resource.toString().indexOf("/commons-logging-1.") > 0);
1f0da8
+                resource.toString().indexOf("/commons-logging-1.2.jar!") > 0);
1f0da8
     }
1f0da8
     
1f0da8
     /**
1f0da8
@@ -259,9 +259,9 @@ public class ParentFirstTestCase extends TestCase {
1f0da8
         urlsToStrings[1] = urls[1].toString();
1f0da8
         Arrays.sort(urlsToStrings);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                urlsToStrings[0].indexOf("/commons-logging-1.") > 0);
1f0da8
+                urlsToStrings[0].indexOf("/commons-logging-1.2-adapters.jar!") > 0);
1f0da8
         assertTrue("Incorrect source for Log4JLogger class",
1f0da8
-                urlsToStrings[1].indexOf("/commons-logging-adapters-1.") > 0);
1f0da8
+                urlsToStrings[1].indexOf("/commons-logging-1.2.jar!") > 0);
1f0da8
         
1f0da8
     }
1f0da8
 
1f0da8
-- 
1f0da8
2.5.5
1f0da8