Skip to content

Commit

Permalink
Shade jars included in java instance uber jar (apache#1849)
Browse files Browse the repository at this point in the history
*Motivation*

dependencies are packaged into a java uber jar for running functions in process mode.
however we don't shade those dependencies, it can potentially conflict with user' function
dependencies

*Solution*

Shade the dependencies included in the java instance uber jar.
  • Loading branch information
sijie authored and merlimat committed May 29, 2018
1 parent 5dcd5c4 commit 1448cd6
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 4 deletions.
6 changes: 6 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,12 @@ flexible messaging model and an intuitive client API.</description>
<groupId>io.grpc</groupId>
<artifactId>grpc-all</artifactId>
<version>${grpc.version}</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-testing</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down
113 changes: 109 additions & 4 deletions pulsar-functions/runtime-all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,10 @@
</goals>
<configuration>
<finalName>java-instance</finalName>
<minimizeJar>false</minimizeJar>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>org.openjdk.jmh.Main</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer" />
</transformers>
<artifactSet>
<excludes>
Expand Down Expand Up @@ -106,6 +105,112 @@
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>com.google</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.google</shadedPattern>
</relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>io.grpc</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.io.grpc</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.bookkeeper</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.apache.bookkeeper</shadedPattern>
</relocation>
<relocation>
<pattern>com.squareup</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.squareup</shadedPattern>
</relocation>
<relocation>
<pattern>okio</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.okio</shadedPattern>
</relocation>
<relocation>
<pattern>org.inferred</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.inferred</shadedPattern>
</relocation>
<relocation>
<pattern>org.jboss</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.jboss</shadedPattern>
</relocation>
<relocation>
<pattern>com.fasterxml.jackson</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.fasterxml.jackson</shadedPattern>
</relocation>
<relocation>
<pattern>com.beust</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.beust</shadedPattern>
</relocation>
<relocation>
<pattern>net.jodah</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.net.jodah</shadedPattern>
</relocation>
<relocation>
<pattern>org.yaml</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.yaml</shadedPattern>
</relocation>
<relocation>
<pattern>org.glassfish</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.glassfish</shadedPattern>
</relocation>
<relocation>
<pattern>com.scurrilous.circe</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.scurrilous.circe</shadedPattern>
</relocation>
<relocation>
<pattern>net.jpountz</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.net.jpountz</shadedPattern>
</relocation>
<relocation>
<pattern>com.yahoo</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.com.yahoo</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.http</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.apache.http</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.commons</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.apache.commons</shadedPattern>
</relocation>
<relocation>
<pattern>org.jvnet</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.jvnet</shadedPattern>
</relocation>
<relocation>
<pattern>io.opencensus</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.io.opencensus</shadedPattern>
</relocation>
<relocation>
<pattern>org.eclipse</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.eclipse</shadedPattern>
</relocation>
<relocation>
<pattern>org.asynchttpclient</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.asynchttpclient</shadedPattern>
</relocation>
<relocation>
<pattern>org.bouncycastle</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.bouncycastle</shadedPattern>
</relocation>
<relocation>
<pattern>jersey</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.jersey</shadedPattern>
</relocation>
<relocation>
<pattern>org.apache.logging</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.org.apache.logging</shadedPattern>
</relocation>
<relocation>
<pattern>javassist</pattern>
<shadedPattern>org.apache.pulsar.functions.runtime.shaded.javassist</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Expand Down

0 comments on commit 1448cd6

Please sign in to comment.