Blame SOURCES/0001-Shade-json-simple-for-JVM-agent-jar.patch

bcd2a8
From e7ab408b8cac0b0881829010c91844bae4bc845d Mon Sep 17 00:00:00 2001
bcd2a8
From: Severin Gehwolf <sgehwolf@redhat.com>
bcd2a8
Date: Tue, 27 Aug 2019 18:33:44 +0200
bcd2a8
Subject: [PATCH] Shade json-simple for JVM agent jar
bcd2a8
bcd2a8
The dependency is then included in its own namespace,
bcd2a8
namely org.jolokia.shaded.org.json.simple*.
bcd2a8
bcd2a8
Closes #398
bcd2a8
---
bcd2a8
 agent/jvm/pom.xml                     | 56 ++++++++++++++++++---------
bcd2a8
 agent/jvm/src/main/assembly/agent.xml | 32 ---------------
bcd2a8
 pom.xml                               |  6 +++
bcd2a8
 3 files changed, 44 insertions(+), 50 deletions(-)
bcd2a8
 delete mode 100644 agent/jvm/src/main/assembly/agent.xml
bcd2a8
bcd2a8
diff --git a/agent/jvm/pom.xml b/agent/jvm/pom.xml
bcd2a8
index f2d5de2d..053fee8b 100644
bcd2a8
--- a/agent/jvm/pom.xml
bcd2a8
+++ b/agent/jvm/pom.xml
bcd2a8
@@ -101,30 +101,50 @@
bcd2a8
         </configuration>
bcd2a8
       </plugin>
bcd2a8
 
bcd2a8
+      
bcd2a8
       <plugin>
bcd2a8
-        <artifactId>maven-assembly-plugin</artifactId>
bcd2a8
-        <configuration>
bcd2a8
-          <descriptors>
bcd2a8
-            <descriptor>src/main/assembly/agent.xml</descriptor>
bcd2a8
-          </descriptors>
bcd2a8
-          <archive>
bcd2a8
-            <manifestEntries>
bcd2a8
-              <Premain-Class>org.jolokia.jvmagent.JvmAgent</Premain-Class>
bcd2a8
-              <Agent-Class>org.jolokia.jvmagent.JvmAgent</Agent-Class>
bcd2a8
-              <Main-Class>org.jolokia.jvmagent.client.AgentLauncher</Main-Class>
bcd2a8
-              <Can-Redefine-Classes>false</Can-Redefine-Classes>
bcd2a8
-              <Can-Retransform-Classes>false</Can-Retransform-Classes>
bcd2a8
-              <Can-Set-Native-Method-Prefix>false</Can-Set-Native-Method-Prefix>
bcd2a8
-            </manifestEntries>
bcd2a8
-          </archive>
bcd2a8
-        </configuration>
bcd2a8
+        <groupId>org.apache.maven.plugins</groupId>
bcd2a8
+        <artifactId>maven-shade-plugin</artifactId>
bcd2a8
+        <version>2.3</version>
bcd2a8
         <executions>
bcd2a8
           <execution>
bcd2a8
-            <id>make-assembly</id>
bcd2a8
             <phase>package</phase>
bcd2a8
             <goals>
bcd2a8
-              <goal>single</goal>
bcd2a8
+              <goal>shade</goal>
bcd2a8
             </goals>
bcd2a8
+            <configuration>
bcd2a8
+              <relocations>
bcd2a8
+                <relocation>
bcd2a8
+                  <shadedPattern>org.jolokia.shaded.</shadedPattern>
bcd2a8
+                  <includes>
bcd2a8
+                    <include>org.json.simple.**</include>
bcd2a8
+                  </includes>
bcd2a8
+                  <excludes>
bcd2a8
+                    <exclude>org.jolokia.shaded.**</exclude>
bcd2a8
+                  </excludes>
bcd2a8
+                </relocation>
bcd2a8
+              </relocations>
bcd2a8
+              <filters>
bcd2a8
+                <filter>
bcd2a8
+                  <artifact>com.sun:tools</artifact>
bcd2a8
+                  <excludes>
bcd2a8
+                    <exclude>**</exclude>
bcd2a8
+                  </excludes>
bcd2a8
+                </filter>
bcd2a8
+              </filters>
bcd2a8
+              <transformers>
bcd2a8
+                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
bcd2a8
+                  <manifestEntries>
bcd2a8
+                    <Premain-Class>org.jolokia.jvmagent.JvmAgent</Premain-Class>
bcd2a8
+                    <Agent-Class>org.jolokia.jvmagent.JvmAgent</Agent-Class>
bcd2a8
+                    <Main-Class>org.jolokia.jvmagent.client.AgentLauncher</Main-Class>
bcd2a8
+                    <Can-Redefine-Classes>false</Can-Redefine-Classes>
bcd2a8
+                    <Can-Retransform-Classes>false</Can-Retransform-Classes>
bcd2a8
+                    <Can-Set-Native-Method-Prefix>false</Can-Set-Native-Method-Prefix>
bcd2a8
+                  </manifestEntries>
bcd2a8
+                </transformer>
bcd2a8
+              </transformers>
bcd2a8
+            </configuration>
bcd2a8
           </execution>
bcd2a8
         </executions>
bcd2a8
       </plugin>
bcd2a8
diff --git a/agent/jvm/src/main/assembly/agent.xml b/agent/jvm/src/main/assembly/agent.xml
bcd2a8
deleted file mode 100644
bcd2a8
index cc125050..00000000
bcd2a8
--- a/agent/jvm/src/main/assembly/agent.xml
bcd2a8
+++ /dev/null
bcd2a8
@@ -1,32 +0,0 @@
bcd2a8
-
bcd2a8
-
bcd2a8
-  ~ Copyright 2009-2012  Roland Huss
bcd2a8
-  ~
bcd2a8
-  ~ Licensed under the Apache License, Version 2.0 (the "License");
bcd2a8
-  ~ you may not use this file except in compliance with the License.
bcd2a8
-  ~ You may obtain a copy of the License at
bcd2a8
-  ~
bcd2a8
-  ~     http://www.apache.org/licenses/LICENSE-2.0
bcd2a8
-  ~
bcd2a8
-  ~ Unless required by applicable law or agreed to in writing, software
bcd2a8
-  ~ distributed under the License is distributed on an "AS IS" BASIS,
bcd2a8
-  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bcd2a8
-  ~ See the License for the specific language governing permissions and
bcd2a8
-  ~ limitations under the License.
bcd2a8
-  -->
bcd2a8
-
bcd2a8
-<assembly>
bcd2a8
-  <id>agent</id>
bcd2a8
-  <formats>
bcd2a8
-    <format>jar</format>
bcd2a8
-  </formats>
bcd2a8
-  <includeBaseDirectory>false</includeBaseDirectory>
bcd2a8
-  <dependencySets>
bcd2a8
-    <dependencySet>
bcd2a8
-      <outputFileNameMapping>${artifact.artifactId}.${artifact.extension}</outputFileNameMapping>
bcd2a8
-      <unpack>true</unpack>
bcd2a8
-      <scope>runtime</scope>
bcd2a8
-      <useProjectArtifact>true</useProjectArtifact>
bcd2a8
-    </dependencySet>
bcd2a8
-  </dependencySets>
bcd2a8
-</assembly>
bcd2a8
\ No newline at end of file
bcd2a8
diff --git a/pom.xml b/pom.xml
bcd2a8
index 54608911..9fcf5178 100644
bcd2a8
--- a/pom.xml
bcd2a8
+++ b/pom.xml
bcd2a8
@@ -218,6 +218,12 @@
bcd2a8
           <version>2.5</version>
bcd2a8
         </plugin>
bcd2a8
 
bcd2a8
+        <plugin>
bcd2a8
+          <groupId>org.apache.maven.plugins</groupId>
bcd2a8
+          <artifactId>maven-shade-plugin</artifactId>
bcd2a8
+          <version>2.3</version>
bcd2a8
+        </plugin>
bcd2a8
+
bcd2a8
         <plugin>
bcd2a8
           <artifactId>maven-deploy-plugin</artifactId>
bcd2a8
           <version>2.8.2</version>
bcd2a8
-- 
bcd2a8
2.21.0
bcd2a8