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