You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by rf...@apache.org on 2020/04/18 15:38:08 UTC

[maven-assembly-plugin] 01/01: [MASSEMBLY-891] Multi-release JAR files aren't handled correctly

This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MASSEMBLY-891
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git

commit 940f354f3218a7866386bd4197345193ea402621
Author: rfscholte <rf...@apache.org>
AuthorDate: Sat Apr 18 17:37:58 2020 +0200

    [MASSEMBLY-891] Multi-release JAR files aren't handled correctly
---
 src/it/projects/bugs/massembly-891/pom.xml       | 64 ++++++++++++++++++++++++
 src/it/projects/bugs/massembly-891/verify.groovy | 36 +++++++++++++
 2 files changed, 100 insertions(+)

diff --git a/src/it/projects/bugs/massembly-891/pom.xml b/src/it/projects/bugs/massembly-891/pom.xml
new file mode 100644
index 0000000..09e5e7c
--- /dev/null
+++ b/src/it/projects/bugs/massembly-891/pom.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.assembly.it</groupId>
+  <artifactId>massembly891</artifactId>
+  <version>0.0.1-SNAPSHOT</version>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <descriptorRefs>
+            <descriptorRef>jar-with-dependencies</descriptorRef>
+          </descriptorRefs>
+        </configuration>
+        <executions>
+          <execution>
+            <id>make-assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.logging.log4j</groupId>
+      <artifactId>log4j-api</artifactId>
+      <version>2.9.1</version>
+    </dependency>
+  </dependencies>
+</project>
diff --git a/src/it/projects/bugs/massembly-891/verify.groovy b/src/it/projects/bugs/massembly-891/verify.groovy
new file mode 100644
index 0000000..0e0cb33
--- /dev/null
+++ b/src/it/projects/bugs/massembly-891/verify.groovy
@@ -0,0 +1,36 @@
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.util.jar.*
+
+def log4jApi = new JarFile(new File(localRepositoryPath, 'org/apache/logging/log4j/log4j-api/2.9.1/log4j-api-2.9.1.jar'))
+def jarWithDeps = new JarFile(new File( basedir, 'target/massembly891-0.0.1-SNAPSHOT-jar-with-dependencies.jar'))
+
+cls = 'org/apache/logging/log4j/util/StackLocator.class'
+assert log4jApi.getEntry(cls) != null
+assert jarWithDeps.getEntry(cls) != null
+assert log4jApi.getEntry(cls).size == jarWithDeps.getEntry(cls).size 
+assert log4jApi.getEntry(cls).time == jarWithDeps.getEntry(cls).time 
+
+cls = 'META-INF/versions/9/org/apache/logging/log4j/util/StackLocator.class'
+assert log4jApi.getEntry(cls) != null
+assert jarWithDeps.getEntry(cls) != null
+assert log4jApi.getEntry(cls).size == jarWithDeps.getEntry(cls).size 
+assert log4jApi.getEntry(cls).time == jarWithDeps.getEntry(cls).time