Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential class conflict during jetcd-core-shaded shading process #4532

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Shawyeok
Copy link
Contributor

Motivation

This a make up patch for #4526, which missed the root cause to fix potential jetcd-core shading problem.

Because the maven-shade-plugin includes the current project artifact during the shade process. In jetcd-core-shaded, we copy io.etcd.jetcd.* into the jetcd-core-shaded jar without relocation. As a result, when the install or deploy goals are executed without cleaning the target folder, class conflicts arise between io.etcd.jetcd.* inside org.apache.bookkeeper.metadata.drivers:jetcd-core-shaded.jar and io.etcd:jetcd-core.jar.

Verifying this Change

To verify this patch, follow these steps:

# Step 1: Clean and install the `jetcd-core-shaded` module.
mvn clean install -pl metadata-drivers/jetcd-core-shaded -DskipTests

# Step 2: Install without cleaning, simulating a build release process.
mvn install -pl metadata-drivers/jetcd-core-shaded -DskipTests

# Step 3: Unpack the shaded jar into a directory and verify imports.
# Ensure that the import statement for `io.netty.handler.logging.ByteBufFormat` 
# in `org/apache/pulsar/jetcd/shaded/io/vertx/core/net/NetClientOptions.class` 
# is correct. The expected import is:
# `import io.grpc.netty.shaded.io.netty.handler.logging.ByteBufFormat;`.
unzip $M2_REPO/org/apache/bookkeeper/metadata/drivers/jetcd-core-shaded/<VERSION>/jetcd-core-shaded-<VERSION>.jar \
  -d metadata-drivers/jetcd-core-shaded/target/shaded-classes

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @Shawyeok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants