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