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

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