Skip to content

Commit

Permalink
Add jetcd-core-shaded module which uses grpc-netty-shaded
Browse files Browse the repository at this point in the history
  • Loading branch information
lhotari committed Jun 12, 2024
1 parent 2f6ca14 commit 16f48bf
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 6 deletions.
15 changes: 10 additions & 5 deletions metadata-drivers/etcd/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@
</dependency>

<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>${etcd.version}</version>
<groupId>org.apache.bookkeeper.metadata.drivers</groupId>
<artifactId>jetcd-core-shaded</artifactId>
<version>${project.version}</version>
<classifier>shaded</classifier>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>*</artifactId>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand All @@ -66,6 +67,10 @@
<groupId>io.grpc</groupId>
<artifactId>grpc-servlet-jakarta</artifactId>
</exclusion>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
127 changes: 127 additions & 0 deletions metadata-drivers/jetcd-core-shaded/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<?xml version="1.0"?>
<!--
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
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.bookkeeper.metadata.drivers</groupId>
<artifactId>metadata-drivers-parent</artifactId>
<version>4.18.0-SNAPSHOT</version>
<relativePath>..</relativePath>
</parent>
<groupId>org.apache.bookkeeper.metadata.drivers</groupId>
<artifactId>jetcd-core-shaded</artifactId>
<name>Apache BookKeeper :: Metadata Drivers:: jetcd-core shaded</name>

<dependencies>
<dependency>
<groupId>io.etcd</groupId>
<artifactId>jetcd-core</artifactId>
<version>${jetcd.version}</version>
<exclusions>
<exclusion>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty-shaded</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<promoteTransitiveDependencies>true</promoteTransitiveDependencies>
<minimizeJar>false</minimizeJar>
<artifactSet>
<includes>
<include>io.etcd:*</include>
<include>io.vertx:*</include>
</includes>
</artifactSet>
<relocations>
<!-- relocate vertx packages since they will be transformed to use grpc-netty-shaded packages -->
<relocation>
<pattern>io.vertx</pattern>
<shadedPattern>org.apache.pulsar.jetcd.shaded.io.vertx</shadedPattern>
</relocation>
<!-- relocate to use grpc-netty-shaded packages -->
<relocation>
<pattern>io.grpc.netty</pattern>
<shadedPattern>io.grpc.netty.shaded.io.grpc.netty</shadedPattern>
</relocation>
<!-- relocate to use grpc-netty-shaded packages -->
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>io.grpc.netty.shaded.io.netty</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.PluginXmlResourceTransformer"/>
</transformers>
<!-- required for IntelliJ support -->
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
<!-- required for IntelliJ support, for some reason shadedArtifactAttached isn't sufficient alone -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>attach-shaded-jar</id>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>${project.build.directory}/${project.artifactId}-${project.version}-shaded.jar</file>
<type>jar</type>
<classifier>shaded</classifier>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
1 change: 1 addition & 0 deletions metadata-drivers/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<packaging>pom</packaging>
<name>Apache BookKeeper :: Metadata Drivers :: Parent</name>
<modules>
<module>jetcd-core-shaded</module>
<module>etcd</module>
</modules>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<curator.version>5.1.0</curator.version>
<disruptor.version>4.0.0</disruptor.version>
<dropwizard.version>4.1.12.1</dropwizard.version>
<etcd.version>0.7.7</etcd.version>
<jetcd.version>0.7.7</jetcd.version>
<freebuilder.version>2.8.0</freebuilder.version>
<google.code.version>3.0.2</google.code.version>
<google.errorprone.version>2.9.0</google.errorprone.version>
Expand Down

0 comments on commit 16f48bf

Please sign in to comment.