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