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