snowflakedb/snowflake-jdbc

SNOW-905110: META-INF/versions entires are not relocated

Closed this issue ยท 7 comments

After #1382, the classes in META-INF/versions are no longer relocated to the shaded location.

This can be dangerous for consumers that depend on these bouncycastle JARs, since the versions bundled in snowflake-jdbc may be loaded instead, which can lead to runtime failures if consumers are using a newer version of bouncycastle.

Screenshot 2023-08-31 at 12 27 35 PM

There are two issues with #1382:

  • The sortpom plugin was added and configured with a sortPlugins element that reordered the plugins. Maven plugins are applied in the order in which they are declared. This caused the maven-antrun-plugin (which performs the relocations) to be applied before the maven-shade-plugin.
  • The move elements were removed from the maven-antrun-plugin. Without this, META-INF/versions will contain both the original and relocated classes.

Thanks @pkoenig10 for submitting the PR. We will review it internally and provide feedback.

I just noticed some compilation errors with Jackson being built against Java 17/19 for similar reasons, would it be possible to fix those issues alongside with a similar solution?

Yes, in snowflake-jdbc 3.14.2 -> 3.14.3 there were more META-INF entries added for Jackson that aren't correctly shaded. My CI shows the diff:

Screenshot 2023-11-16 at 11 24 39 AM

@sfc-gh-spanaite are you able to review the PR and provide feedback?

Just found this issue after having to skip/close another upgrade PR (3.14.5 released yesterday) because of this issue.

We have merged PR #1621 fixing the relocation of classes in META-INF and it will be included in the February 2024 release. If you want to test it now you can build the driver from source as described in README

The fix was released in 3.15.0

Yes this seems to be corrected now in 3.15.0

Thank you!