-
Notifications
You must be signed in to change notification settings - Fork 588
HDDS-12462. Use exclude rules for defining shaded filesystem jar contents #8008
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
Changes from 9 commits
0fde989
1eadebf
696ecb3
520031e
1e45f38
efe5471
892df45
90361b0
7111c6e
b5d92f9
5c46400
dc217c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -27,6 +27,9 @@ | |||||||||||||||
| <properties> | ||||||||||||||||
| <!-- no tests in this module so far --> | ||||||||||||||||
| <maven.test.skip>true</maven.test.skip> | ||||||||||||||||
| <ozone.shaded.native.prefix>org_apache_hadoop_ozone_shaded</ozone.shaded.native.prefix> | ||||||||||||||||
| <!-- refer to ratis thirdparty ratis.thirdparty.shaded.native.prefix --> | ||||||||||||||||
| <ratis.thirdparty.shaded.native.prefix>org_apache_ratis_thirdparty_</ratis.thirdparty.shaded.native.prefix> | ||||||||||||||||
| <shaded.prefix>org.apache.hadoop.ozone.shaded</shaded.prefix> | ||||||||||||||||
|
||||||||||||||||
| </properties> | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -35,6 +38,30 @@ | |||||||||||||||
| <groupId>com.google.protobuf</groupId> | ||||||||||||||||
| <artifactId>protobuf-java</artifactId> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>io.netty</groupId> | ||||||||||||||||
| <artifactId>netty-resolver-dns-native-macos</artifactId> | ||||||||||||||||
| <classifier>osx-x86_64</classifier> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>io.netty</groupId> | ||||||||||||||||
| <artifactId>netty-tcnative-boringssl-static</artifactId> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>io.netty</groupId> | ||||||||||||||||
| <artifactId>netty-transport-native-epoll</artifactId> | ||||||||||||||||
| <classifier>linux-aarch_64</classifier> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>io.netty</groupId> | ||||||||||||||||
| <artifactId>netty-transport-native-epoll</artifactId> | ||||||||||||||||
| <classifier>linux-x86_64</classifier> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>io.netty</groupId> | ||||||||||||||||
| <artifactId>netty-transport-native-kqueue</artifactId> | ||||||||||||||||
| <classifier>osx-x86_64</classifier> | ||||||||||||||||
| </dependency> | ||||||||||||||||
| <dependency> | ||||||||||||||||
| <groupId>org.apache.ozone</groupId> | ||||||||||||||||
| <artifactId>ozone-filesystem-common</artifactId> | ||||||||||||||||
|
|
@@ -75,6 +102,10 @@ | |||||||||||||||
| <groupId>org.apache.logging.log4j</groupId> | ||||||||||||||||
| <artifactId>*</artifactId> | ||||||||||||||||
| </exclusion> | ||||||||||||||||
| <exclusion> | ||||||||||||||||
| <groupId>org.junit</groupId> | ||||||||||||||||
| <artifactId>*</artifactId> | ||||||||||||||||
| </exclusion> | ||||||||||||||||
| <exclusion> | ||||||||||||||||
| <groupId>org.slf4j</groupId> | ||||||||||||||||
| <artifactId>*</artifactId> | ||||||||||||||||
|
|
@@ -102,6 +133,52 @@ | |||||||||||||||
| <phase>package</phase> | ||||||||||||||||
| <configuration> | ||||||||||||||||
| <skip>${maven.shade.skip}</skip> | ||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @adoroszlai @ChenSammi We should have two options for Ozone dependencies
In this way, the ozone release package will only contain shaded dependencies, and for these unshaded dependencies, Ozone will assume that Hadoop env provides these dependencies. How do you think ?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. Hadoop is also not included in the fat jar, so it cannot work without Hadoop anyway.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If a user directly depend on Ozone and use Ozone's Filesystem without introducing Hadoop's package, can the current Ozone fat-jar provide all necessary dependencies? |
||||||||||||||||
| <artifactSet> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <exclude>com.sun.javadoc:*</exclude> | ||||||||||||||||
| <exclude>com.sun.jndi:*</exclude> | ||||||||||||||||
| <exclude>com.sun.management:*</exclude> | ||||||||||||||||
| <exclude>com.sun.security:*</exclude> | ||||||||||||||||
| <exclude>com.sun.tools:*</exclude> | ||||||||||||||||
| <exclude>org.ietf.jgss:*</exclude> | ||||||||||||||||
| <exclude>org.omg:*</exclude> | ||||||||||||||||
| <exclude>org.w3c.dom:*</exclude> | ||||||||||||||||
| <exclude>org.xerial.snappy:*</exclude> | ||||||||||||||||
| <exclude>org.xml.sax:*</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </artifactSet> | ||||||||||||||||
| <filters> | ||||||||||||||||
| <filter> | ||||||||||||||||
| <artifact>*:*</artifact> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <!-- Exclude android (dependency from io.grpc:grpc-core) to reduce unnecessary dependencies and avoid potential conflicts --> | ||||||||||||||||
| <exclude>android/**</exclude> | ||||||||||||||||
| <!-- Hadoop env provides these dependencies. | ||||||||||||||||
| To prevent conflicts, remove them from Ozone release package.--> | ||||||||||||||||
| <exclude>javax/annotation/**</exclude> | ||||||||||||||||
| <!-- Filter ratis thirdparty shaded netty_tcnative libs --> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_resolver_dns_native_macos_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_tcnative_linux_aarch_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_tcnative_linux_x86_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_tcnative_osx_aarch_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_tcnative_osx_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_transport_native_epoll_aarch_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_transport_native_epoll_x86_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/liborg_apache_ratis_thirdparty_netty_transport_native_kqueue_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/org_apache_ratis_thirdparty_netty_tcnative_windows_x86_64.dll</exclude> | ||||||||||||||||
| <!-- Filter unshaded netty_tcnative libs --> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_resolver_dns_native_macos_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_tcnative_linux_aarch_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_tcnative_linux_x86_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_tcnative_osx_aarch_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_tcnative_osx_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_transport_native_epoll_aarch_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_transport_native_epoll_x86_64.so</exclude> | ||||||||||||||||
| <exclude>META-INF/native/libnetty_transport_native_kqueue_x86_64.jnilib</exclude> | ||||||||||||||||
| <exclude>META-INF/native/netty_tcnative_windows_x86_64.dll</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </filter> | ||||||||||||||||
| </filters> | ||||||||||||||||
| <transformers> | ||||||||||||||||
| <transformer implementation="org.apache.maven.plugins.shade.resource.DontIncludeResourceTransformer"> | ||||||||||||||||
| <resources> | ||||||||||||||||
|
|
@@ -120,38 +197,66 @@ | |||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>org</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.org</shadedPattern> | ||||||||||||||||
| <includes> | ||||||||||||||||
| <include>org.yaml.**.*</include> | ||||||||||||||||
| <include>org.sqlite.**.*</include> | ||||||||||||||||
| <include>org.tukaani.**.*</include> | ||||||||||||||||
| <include>org.bouncycastle.**.*</include> | ||||||||||||||||
| <include>org.rocksdb.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.cli.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.compress.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.codec.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.beanutils.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.collections.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.digester.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.io.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.logging.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.validator.**.*</include> | ||||||||||||||||
| <include>org.apache.commons.lang3.**.*</include> | ||||||||||||||||
| <include>org.sqlite.**.*</include> | ||||||||||||||||
| <include>org.apache.thrift.**.*</include> | ||||||||||||||||
| </includes> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <exclude>org.apache.hadoop.**</exclude> | ||||||||||||||||
| <exclude>org.apache.log4j.**</exclude> | ||||||||||||||||
| <exclude>org.apache.ozone.**</exclude> | ||||||||||||||||
| <exclude>org.apache.ratis.**</exclude> | ||||||||||||||||
| <!-- These packages are the ones that are not shaded in the hadoop release package. | ||||||||||||||||
| To prevent conflicts, we do not include these packages in the ozone client release package. | ||||||||||||||||
| Ozone will use hadoop / JVM to provide these dependencies. --> | ||||||||||||||||
| <exclude>org.ietf.jgss.*</exclude> | ||||||||||||||||
| <exclude>org.omg.**</exclude> | ||||||||||||||||
| <exclude>org.slf4j.**</exclude> | ||||||||||||||||
| <exclude>org.w3c.dom.**</exclude> | ||||||||||||||||
| <exclude>org.xerial.snappy.**</exclude> | ||||||||||||||||
| <exclude>org.xml.sax.**</exclude> | ||||||||||||||||
| <exclude>org.wildfly.**</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>org.apache.ratis</pattern> | ||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||
| <shadedPattern>${shaded.prefix}.org.apache.ratis</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>com</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.com</shadedPattern> | ||||||||||||||||
| <includes> | ||||||||||||||||
| <include>com.google.common.**.*</include> | ||||||||||||||||
| <include>com.google.gson.**.*</include> | ||||||||||||||||
| <include>com.codahale.**.*</include> | ||||||||||||||||
| <include>com.fasterxml.**.*</include> | ||||||||||||||||
| <include>com.lmax.**.*</include> | ||||||||||||||||
| <include>com.github.joshelser.**.*</include> | ||||||||||||||||
| <include>com.twitter.**.*</include> | ||||||||||||||||
| </includes> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <exclude>com.google.protobuf.**</exclude> | ||||||||||||||||
| <!-- These packages are the ones that are not shaded in the hadoop release package. | ||||||||||||||||
| To prevent conflicts, we do not include these packages in the ozone client release package. | ||||||||||||||||
| Ozone will use hadoop / JVM to provide these dependencies. --> | ||||||||||||||||
| <exclude>com.sun.javadoc.**</exclude> | ||||||||||||||||
| <exclude>com.sun.jndi.**</exclude> | ||||||||||||||||
| <exclude>com.sun.management.**</exclude> | ||||||||||||||||
| <exclude>com.sun.security.**</exclude> | ||||||||||||||||
| <exclude>com.sun.tools.**</exclude> | ||||||||||||||||
| <exclude>com.ibm.security.**</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>google</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.google</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>net.jcip</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.net.jcip</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>javassist</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.javassist</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>javax.xml.bind</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.javax.xml.bind</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>javax.activation</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.javax.activation</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>jakarta.annotation</pattern> | ||||||||||||||||
| <shadedPattern>${shaded.prefix}.jakarta.annotation</shadedPattern> | ||||||||||||||||
| </relocation> | ||||||||||||||||
| <relocation> | ||||||||||||||||
| <pattern>kotlin</pattern> | ||||||||||||||||
|
|
@@ -170,6 +275,18 @@ | |||||||||||||||
| <shadedPattern>${shaded.prefix}.io</shadedPattern> | ||||||||||||||||
| <excludes> | ||||||||||||||||
| <exclude>io!netty!*</exclude> | ||||||||||||||||
| <!-- Exclude config keys for Hadoop that look like package names --> | ||||||||||||||||
| <!-- These packages are the ones that are not shaded in the hadoop release package. | ||||||||||||||||
| To prevent conflicts, we do not include these packages in the ozone client release package. | ||||||||||||||||
| Ozone will use hadoop / JVM to provide these dependencies. --> | ||||||||||||||||
| <exclude>io.compression.**</exclude> | ||||||||||||||||
| <exclude>io.file.buffer.size</exclude> | ||||||||||||||||
| <exclude>io.mapfile.**</exclude> | ||||||||||||||||
| <exclude>io.map.index</exclude> | ||||||||||||||||
| <exclude>io.seqfile.**</exclude> | ||||||||||||||||
| <exclude>io.serializations</exclude> | ||||||||||||||||
| <exclude>io.skip.checksum.errors</exclude> | ||||||||||||||||
| <exclude>io.sort.**</exclude> | ||||||||||||||||
| </excludes> | ||||||||||||||||
| </relocation> | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -187,6 +304,87 @@ | |||||||||||||||
| </execution> | ||||||||||||||||
| </executions> | ||||||||||||||||
| </plugin> | ||||||||||||||||
| <plugin> | ||||||||||||||||
| <groupId>org.apache.maven.plugins</groupId> | ||||||||||||||||
| <artifactId>maven-dependency-plugin</artifactId> | ||||||||||||||||
| <version>${maven-dependency-plugin.version}</version> | ||||||||||||||||
|
||||||||||||||||
| <executions> | ||||||||||||||||
| <execution> | ||||||||||||||||
| <id>unpack-dependencies</id> | ||||||||||||||||
| <goals> | ||||||||||||||||
| <goal>unpack-dependencies</goal> | ||||||||||||||||
| </goals> | ||||||||||||||||
| <phase>validate</phase> | ||||||||||||||||
| <configuration> | ||||||||||||||||
| <includeGroupIds>io.netty</includeGroupIds> | ||||||||||||||||
| <includes>**/META-INF/native/*</includes> | ||||||||||||||||
| <includeArtifactIds>netty-resolver-dns-native-macos, | ||||||||||||||||
| netty-tcnative-boringssl-static, | ||||||||||||||||
| netty-transport-native-epoll, | ||||||||||||||||
| netty-transport-native-kqueue</includeArtifactIds> | ||||||||||||||||
| <outputDirectory>${project.build.directory}/classes/</outputDirectory> | ||||||||||||||||
| <overWriteReleases>true</overWriteReleases> | ||||||||||||||||
| <overWriteSnapshots>true</overWriteSnapshots> | ||||||||||||||||
| </configuration> | ||||||||||||||||
| </execution> | ||||||||||||||||
| </executions> | ||||||||||||||||
| </plugin> | ||||||||||||||||
| <!-- The native libraries need to be named in the same way we relocate the Netty classes via the shade-plugin --> | ||||||||||||||||
| <!-- We shaded ratis thirdparty, so the dynamic library name here includes both ratis thirdparty shaded and ozone shaded--> | ||||||||||||||||
| <plugin> | ||||||||||||||||
| <groupId>com.coderplus.maven.plugins</groupId> | ||||||||||||||||
| <artifactId>copy-rename-maven-plugin</artifactId> | ||||||||||||||||
| <version>${copy-rename-maven-plugin.version}</version> | ||||||||||||||||
|
||||||||||||||||
| <pluginManagement> | |
| <plugins> | |
| <plugin> | |
| <groupId>com.github.ekryd.sortpom</groupId> | |
| <artifactId>sortpom-maven-plugin</artifactId> | |
| <version>${sortpom-maven-plugin.version}</version> | |
| </plugin> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about removing hadoop, i.e.
org_apache_ozone_shaded?