sijie closed pull request #1095: BP-26 (task 3) : Build dlog shaded jar in bookkeeper way URL: https://github.com/apache/bookkeeper/pull/1095
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/bookkeeper-server/pom.xml b/bookkeeper-server/pom.xml index f0721b6ab..ba6f24891 100644 --- a/bookkeeper-server/pom.xml +++ b/bookkeeper-server/pom.xml @@ -220,46 +220,6 @@ <inherited>true</inherited> <extensions>true</extensions> </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-shade-plugin</artifactId> - <version>${maven-shade-plugin.version}</version> - <configuration> - <!-- put your configurations here --> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <createDependencyReducedPom>true</createDependencyReducedPom> - <promoteTransitiveDependencies>false</promoteTransitiveDependencies> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>shaded</shadedClassifierName> - <minimizeJar>true</minimizeJar> - <shadeTestJar>true</shadeTestJar> - <artifactSet> - <includes> - <include>com.google.guava:guava</include> - <include>com.google.protobuf:protobuf-java</include> - <include>org.apache.bookkeeper:bookkeeper-common</include> - <include>org.apache.bookkeeper:bookkeeper-proto</include> - <include>org.apache.bookkeeper:circe-checksum</include> - <include>org.apache.bookkeeper.stats:bookkeeper-stats-api</include> - </includes> - </artifactSet> - <relocations> - <relocation> - <pattern>com.google</pattern> - <shadedPattern>org.apache.bookkeeper.shaded.com.google</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - </executions> - </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> diff --git a/shaded/distributedlog-core-shaded/pom.xml b/shaded/distributedlog-core-shaded/pom.xml new file mode 100644 index 000000000..ba147ab5c --- /dev/null +++ b/shaded/distributedlog-core-shaded/pom.xml @@ -0,0 +1,245 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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</groupId> + <artifactId>shaded-parent</artifactId> + <version>4.7.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-core-shaded</artifactId> + <name>Apache BookKeeper :: Shaded :: distributedlog-core-shaded</name> + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + <dependencies> + <dependency> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-core</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-log4j12</artifactId> + </exclusion> + <exclusion> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <version>${maven-shade-plugin.version}</version> + <executions> + <execution> + <phase>package</phase> + <goals> + <goal>shade</goal> + </goals> + <configuration> + <createDependencyReducedPom>true</createDependencyReducedPom> + <promoteTransitiveDependencies>true</promoteTransitiveDependencies> + <minimizeJar>false</minimizeJar> + <artifactSet> + <includes> + <include>commons-codec:commons-codec</include> + <include>commons-cli:commons-cli</include> + <include>commons-io:commons-io</include> + <include>commons-lang:commons-lang</include> + <include>commons-logging:commons-logging</include> + <include>com.fasterxml.jackson.core:jackson-core</include> + <include>com.fasterxml.jackson.core:jackson-databind</include> + <include>com.fasterxml.jackson.core:jackson-annotations</include> + <include>com.google.guava:guava</include> + <include>com.google.protobuf:protobuf-java</include> + <include>io.netty:netty</include> + <include>io.netty:netty-all</include> + <include>io.netty:netty-buffer</include> + <include>io.netty:netty-common</include> + <include>io.netty:netty-tcnative-boringssl-static</include> + <include>net.java.dev.jna:jna</include> + <include>net.jpountz.lz4:lz4</include> + <include>org.apache.bookkeeper:bookkeeper-common</include> + <include>org.apache.bookkeeper:bookkeeper-proto</include> + <include>org.apache.bookkeeper:bookkeeper-server</include> + <include>org.apache.bookkeeper:circe-checksum</include> + <include>org.apache.bookkeeper.http:http-server</include> + <include>org.apache.bookkeeper.stats:bookkeeper-stats-api</include> + <include>org.apache.commons:commons-collections4</include> + <include>org.apache.commons:commons-lang3</include> + <include>org.apache.distributedlog:distributedlog-common</include> + <include>org.apache.distributedlog:distributedlog-core</include> + <include>org.apache.distributedlog:distributedlog-protocol</include> + <include>org.apache.httpcomponents:httpclient</include> + <include>org.apache.httpcomponents:httpcore</include> + <include>org.apache.thrift:libthrift</include> + <include>org.apache.zookeeper:zookeeper</include> + <include>org.rocksdb:rocksdbjni</include> + </includes> + </artifactSet> + <relocations> + <!-- apache commons --> + <relocation> + <pattern>org.apache.commons.cli</pattern> + <shadedPattern>dlshade.org.apache.commons.cli</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.codec</pattern> + <shadedPattern>dlshade.org.apache.commons.codec</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.collections4</pattern> + <shadedPattern>dlshade.org.apache.commons.collections4</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.lang</pattern> + <shadedPattern>dlshade.org.apache.commons.lang</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.lang3</pattern> + <shadedPattern>dlshade.org.apache.commons.lang3</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.logging</pattern> + <shadedPattern>dlshade.org.apache.commons.logging</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.commons.io</pattern> + <shadedPattern>dlshade.org.apache.commons.io</shadedPattern> + </relocation> + <!-- apache httpcomponents --> + <relocation> + <pattern>org.apache.httpcomponents</pattern> + <shadedPattern>dlshade.org.apache.httpcomponents</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.http</pattern> + <shadedPattern>dlshade.org.apache.http</shadedPattern> + </relocation> + <!-- apache thrift --> + <relocation> + <pattern>org.apache.thrift</pattern> + <shadedPattern>dlshade.org.apache.thrift</shadedPattern> + </relocation> + <!-- apache zookeeper --> + <relocation> + <pattern>org.apache.zookeeper</pattern> + <shadedPattern>dlshade.org.apache.zookeeper</shadedPattern> + </relocation> + <relocation> + <pattern>org.apache.jute</pattern> + <shadedPattern>dlshade.org.apache.jute</shadedPattern> + </relocation> + <!-- jackson --> + <relocation> + <pattern>com.fasterxml.jackson</pattern> + <shadedPattern>dlshade.com.fasterxml.jackson</shadedPattern> + </relocation> + <!-- jna --> + <relocation> + <pattern>com.sun.jna</pattern> + <shadedPattern>dlshade.com.sun.jna</shadedPattern> + </relocation> + <!-- guava & protobuf --> + <relocation> + <pattern>com.google</pattern> + <shadedPattern>dlshade.com.google</shadedPattern> + </relocation> + <!-- netty --> + <relocation> + <pattern>io.netty</pattern> + <shadedPattern>dlshade.io.netty</shadedPattern> + </relocation> + <relocation> + <pattern>org.jboss.netty</pattern> + <shadedPattern>dlshade.org.jboss.netty</shadedPattern> + </relocation> + <!-- lz4 --> + <relocation> + <pattern>net.jpountz</pattern> + <shadedPattern>dlshade.net.jpountz</shadedPattern> + </relocation> + <!-- rocksdb --> + <relocation> + <pattern>org.rocksdb</pattern> + <shadedPattern>dlshade.org.rocksdb</shadedPattern> + </relocation> + <!-- bookkeeper --> + <relocation> + <pattern>org.apache.bookkeeper</pattern> + <shadedPattern>org.apache.bookkeeper</shadedPattern> + </relocation> + <!-- distributedlog --> + <relocation> + <pattern>org.apache.distributedlog</pattern> + <shadedPattern>org.apache.distributedlog</shadedPattern> + </relocation> + </relocations> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>license-maven-plugin</artifactId> + <version>1.6</version> + <configuration> + <canUpdateCopyright>false</canUpdateCopyright> + <roots><root>${project.basedir}</root></roots> + </configuration> + <executions> + <execution> + <id>update-pom-license</id> + <goals> + <goal>update-file-header</goal> + </goals> + <phase>package</phase> + <configuration> + <licenseName>apache_v2</licenseName> + <includes> + <include>dependency-reduced-pom.xml</include> + </includes> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <artifactId>maven-clean-plugin</artifactId> + <version>2.5</version> + <configuration> + <filesets> + <fileset> + <directory>${project.basedir}</directory> + <includes> + <include>dependency-reduced-pom.xml</include> + </includes> + </fileset> + </filesets> + </configuration> + </plugin> + </plugins> + </build> +</project> diff --git a/shaded/pom.xml b/shaded/pom.xml index a1544eb8e..3cfdb0d0d 100644 --- a/shaded/pom.xml +++ b/shaded/pom.xml @@ -30,5 +30,6 @@ <modules> <module>bookkeeper-server-shaded</module> <module>bookkeeper-server-tests-shaded</module> + <module>distributedlog-core-shaded</module> </modules> </project> diff --git a/site/docs/latest/api/ledger-api.md b/site/docs/latest/api/ledger-api.md index 2fef7dcc6..51a6e847c 100644 --- a/site/docs/latest/api/ledger-api.md +++ b/site/docs/latest/api/ledger-api.md @@ -34,35 +34,6 @@ BookKeeper uses google [protobuf](https://github.com/google/protobuf/tree/master a lot. If your application might include different versions of protobuf or guava introduced by other dependencies, you can choose to use the shaded library, which relocate classes of protobuf and guava into a different namespace to avoid conflicts. -You can use the shaded artifact of `bookkeeper-server`. Please note that [maven-shade-plugin](https://maven.apache.org/plugins/maven-shade-plugin) doesn't generate -a dependency-reduced pom file for shaded artifact using [shadedArtifactAttached](https://maven.apache.org/plugins/maven-shade-plugin/examples/attached-artifact.html). You need to manually to exclude relocated packages when using the shaded artifact. Full example of how to use this is -showed as below. - -```xml -<!-- in your <properties> block --> -<bookkeeper.version>{{ site.latest_version }}</bookkeeper.version> - -<!-- in your <dependencies> block --> -<dependency> - <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-server</artifactId> - <version>${bookkeeper.version}</version> - <classifier>shaded</classifier> <!-- specify "shaded" classifier to use shaded artifact --> - <exclusions> - <exclusion> - <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-common</artifactId> - </exclusion> - <exclusion> - <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-proto</artifactId> - </exclusion> - </exclusions> -</dependency> -``` - -Or you can use a separate shaded artifact `bookkeeper-server-shaded`. - ```xml <!-- in your <properties> block --> <bookkeeper.version>{{ site.latest_version }}</bookkeeper.version> @@ -93,15 +64,6 @@ dependencies { Similarly as using maven, you can also configure to use the shaded jars. ```groovy -// use the shaded artifact of `bookkeeper-server` jar -dependencies { - compile ('org.apache.bookkeeper:bookkeeper-server:{{ site.latest-version }}:shaded') { - exclude group: 'org.apache.bookkeeper', module: "bookkeeper-common' - exclude group: 'org.apache.bookkeeper', module: 'bookkeeper-proto' - } -} - - // use the `bookkeeper-server-shaded` jar dependencies { compile 'org.apache.bookkeeper:bookkeeper-server-shaded:{{ site.latest-version }}' diff --git a/stream/distributedlog/common/pom.xml b/stream/distributedlog/common/pom.xml index d5501506a..fe0628e3d 100644 --- a/stream/distributedlog/common/pom.xml +++ b/stream/distributedlog/common/pom.xml @@ -37,9 +37,9 @@ </exclusions> </dependency> <dependency> - <groupId>org.inferred</groupId> - <artifactId>freebuilder</artifactId> - <version>${freebuilder.version}</version> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + <version>${commons-lang3.version}</version> </dependency> <dependency> <groupId>com.google.guava</groupId> diff --git a/stream/distributedlog/core/pom.xml b/stream/distributedlog/core/pom.xml index 9f1673681..48a6b64bd 100644 --- a/stream/distributedlog/core/pom.xml +++ b/stream/distributedlog/core/pom.xml @@ -25,15 +25,21 @@ <artifactId>distributedlog-core</artifactId> <name>Apache BookKeeper :: DistributedLog :: Core Library</name> <dependencies> - <dependency> - <groupId>org.apache.distributedlog</groupId> - <artifactId>distributedlog-common</artifactId> - <version>${project.parent.version}</version> - </dependency> <dependency> <groupId>org.apache.distributedlog</groupId> <artifactId>distributedlog-protocol</artifactId> <version>${project.parent.version}</version> + <exclusions> + <!-- netty-all is introduced by bookkeeper-server --> + <exclusion> + <groupId>io.netty</groupId> + <artifactId>netty-buffer</artifactId> + </exclusion> + <exclusion> + <groupId>io.netty</groupId> + <artifactId>netty-common</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.apache.zookeeper</groupId> @@ -170,273 +176,6 @@ </relocations> </configuration> </execution> - <execution> - <id>shade-bk</id> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <createDependencyReducedPom>true</createDependencyReducedPom> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>bkshade</shadedClassifierName> - <minimizeJar>true</minimizeJar> - <shadeTestJar>true</shadeTestJar> - <artifactSet> - <includes> - <include>commons-codec:commons-codec</include> - <include>commons-cli:commons-cli</include> - <include>commons-io:commons-io</include> - <include>commons-lang:commons-lang</include> - <include>com.google.guava:guava</include> - <include>com.google.protobuf:protobuf-java</include> - <include>io.netty:netty</include> - <include>io.netty:netty-all</include> - <include>io.netty:netty-buffer</include> - <include>io.netty:netty-common</include> - <include>io.netty:netty-tcnative-boringssl-static</include> - <include>net.java.dev.jna:jna</include> - <include>net.jpountz.lz4:lz4</include> - <include>org.apache.bookkeeper.stats:bookkeeper-stats-api</include> - <include>org.apache.bookkeeper:bookkeeper-server</include> - <include>org.apache.bookkeeper:bookkeeper-common</include> - <include>org.apache.bookkeeper:bookkeeper-proto</include> - <include>org.apache.bookkeeper:bookkeeper-http</include> - <include>org.apache.commons:commons-lang3</include> - <include>org.apache.distributedlog:distributedlog-common</include> - <include>org.apache.distributedlog:distributedlog-protocol</include> - <include>org.apache.httpcomponents:httpclient</include> - <include>org.apache.httpcomponents:httpcore</include> - <include>org.apache.thrift:libthrift</include> - <include>org.apache.zookeeper:zookeeper</include> - <include>org.inferred:freebuilder</include> - </includes> - </artifactSet> - <minimizeJar>true</minimizeJar> - <relocations> - <!-- apache commons --> - <relocation> - <pattern>org.apache.commons.cli</pattern> - <shadedPattern>dlshade.org.apache.commons.cli</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.codec</pattern> - <shadedPattern>dlshade.org.apache.commons.codec</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.lang</pattern> - <shadedPattern>dlshade.org.apache.commons.lang</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.lang3</pattern> - <shadedPattern>dlshade.org.apache.commons.lang3</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.io</pattern> - <shadedPattern>dlshade.org.apache.commons.io</shadedPattern> - </relocation> - <!-- apache httpcomponents --> - <relocation> - <pattern>org.apache.httpcomponents</pattern> - <shadedPattern>dlshade.org.apache.httpcomponents</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.http</pattern> - <shadedPattern>dlshade.org.apache.http</shadedPattern> - </relocation> - <!-- apache thrift --> - <relocation> - <pattern>org.apache.thrift</pattern> - <shadedPattern>dlshade.org.apache.thrift</shadedPattern> - </relocation> - <!-- apache zookeeper --> - <relocation> - <pattern>org.apache.zookeeper</pattern> - <shadedPattern>org.apache.zookeeper</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.jute</pattern> - <shadedPattern>dlshade.org.apache.jute</shadedPattern> - </relocation> - <!-- freebuilder --> - <relocation> - <pattern>org.inferred.freebuilder</pattern> - <shadedPattern>dlshade.org.inferred.freebuilder</shadedPattern> - </relocation> - <!-- jna --> - <relocation> - <pattern>com.sun.jna</pattern> - <shadedPattern>dlshade.com.sun.jna</shadedPattern> - </relocation> - <!-- guava --> - <relocation> - <pattern>com.google</pattern> - <shadedPattern>dlshade.com.google</shadedPattern> - </relocation> - <!-- netty --> - <!--<relocation>--> - <!--<pattern>io.netty</pattern>--> - <!--<shadedPattern>dlshade.io.netty</shadedPattern>--> - <!--</relocation>--> - <relocation> - <pattern>org.jboss.netty</pattern> - <shadedPattern>dlshade.org.jboss.netty</shadedPattern> - </relocation> - <!-- lz4 --> - <relocation> - <pattern>net.jpountz</pattern> - <shadedPattern>dlshade.net.jpountz</shadedPattern> - </relocation> - <!-- bookkeeper --> - <relocation> - <pattern>org.apache.bookkeeper</pattern> - <shadedPattern>dlshade.org.apache.bookkeeper</shadedPattern> - </relocation> - <!-- distributedlog --> - <relocation> - <pattern>org.apache.distributedlog</pattern> - <shadedPattern>org.apache.distributedlog</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> - <execution> - <id>shade-all</id> - <phase>package</phase> - <goals> - <goal>shade</goal> - </goals> - <configuration> - <createDependencyReducedPom>true</createDependencyReducedPom> - <promoteTransitiveDependencies>true</promoteTransitiveDependencies> - <shadedArtifactAttached>true</shadedArtifactAttached> - <shadedClassifierName>shaded</shadedClassifierName> - <minimizeJar>true</minimizeJar> - <artifactSet> - <includes> - <include>commons-codec:commons-codec</include> - <include>commons-cli:commons-cli</include> - <include>commons-io:commons-io</include> - <include>commons-lang:commons-lang</include> - <include>com.google.guava:guava</include> - <include>com.google.protobuf:protobuf-java</include> - <include>io.netty:netty</include> - <include>io.netty:netty-all</include> - <include>io.netty:netty-buffer</include> - <include>io.netty:netty-common</include> - <include>io.netty:netty-tcnative-boringssl-static</include> - <include>net.java.dev.jna:jna</include> - <include>net.jpountz.lz4:lz4</include> - <include>org.apache.bookkeeper.stats:bookkeeper-stats-api</include> - <include>org.apache.bookkeeper:bookkeeper-server</include> - <include>org.apache.bookkeeper:bookkeeper-common</include> - <include>org.apache.bookkeeper:bookkeeper-proto</include> - <include>org.apache.bookkeeper:bookkeeper-http</include> - <include>org.apache.commons:commons-lang3</include> - <include>org.apache.distributedlog:distributedlog-common</include> - <include>org.apache.distributedlog:distributedlog-protocol</include> - <include>org.apache.httpcomponents:httpclient</include> - <include>org.apache.httpcomponents:httpcore</include> - <include>org.apache.thrift:libthrift</include> - <include>org.apache.zookeeper:zookeeper</include> - <include>org.inferred:freebuilder</include> - </includes> - </artifactSet> - <filters> - <filter> - <artifact>net.jpountz.lz4:lz4</artifact> - <includes> - <include>**</include> - </includes> - </filter> - </filters> - <relocations> - <!-- apache commons --> - <relocation> - <pattern>org.apache.commons.cli</pattern> - <shadedPattern>dlshade.org.apache.commons.cli</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.codec</pattern> - <shadedPattern>dlshade.org.apache.commons.codec</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.lang</pattern> - <shadedPattern>dlshade.org.apache.commons.lang</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.lang3</pattern> - <shadedPattern>dlshade.org.apache.commons.lang3</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.commons.io</pattern> - <shadedPattern>dlshade.org.apache.commons.io</shadedPattern> - </relocation> - <!-- apache httpcomponents --> - <relocation> - <pattern>org.apache.httpcomponents</pattern> - <shadedPattern>dlshade.org.apache.httpcomponents</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.http</pattern> - <shadedPattern>dlshade.org.apache.http</shadedPattern> - </relocation> - <!-- apache thrift --> - <relocation> - <pattern>org.apache.thrift</pattern> - <shadedPattern>dlshade.org.apache.thrift</shadedPattern> - </relocation> - <!-- apache zookeeper --> - <relocation> - <pattern>org.apache.zookeeper</pattern> - <shadedPattern>dlshade.org.apache.zookeeper</shadedPattern> - </relocation> - <relocation> - <pattern>org.apache.jute</pattern> - <shadedPattern>dlshade.org.apache.jute</shadedPattern> - </relocation> - <!-- freebuilder --> - <relocation> - <pattern>org.inferred.freebuilder</pattern> - <shadedPattern>dlshade.org.inferred.freebuilder</shadedPattern> - </relocation> - <!-- jna --> - <relocation> - <pattern>com.sun.jna</pattern> - <shadedPattern>dlshade.com.sun.jna</shadedPattern> - </relocation> - <!-- guava --> - <relocation> - <pattern>com.google</pattern> - <shadedPattern>dlshade.com.google</shadedPattern> - </relocation> - <!-- netty --> - <relocation> - <pattern>io.netty</pattern> - <shadedPattern>dlshade.io.netty</shadedPattern> - </relocation> - <relocation> - <pattern>org.jboss.netty</pattern> - <shadedPattern>dlshade.org.jboss.netty</shadedPattern> - </relocation> - <!-- lz4 --> - <relocation> - <pattern>net.jpountz</pattern> - <shadedPattern>dlshade.net.jpountz</shadedPattern> - </relocation> - <!-- bookkeeper --> - <relocation> - <pattern>org.apache.bookkeeper</pattern> - <shadedPattern>org.apache.bookkeeper</shadedPattern> - </relocation> - <!-- distributedlog --> - <relocation> - <pattern>org.apache.distributedlog</pattern> - <shadedPattern>org.apache.distributedlog</shadedPattern> - </relocation> - </relocations> - </configuration> - </execution> </executions> </plugin> <plugin> diff --git a/tests/pom.xml b/tests/pom.xml index 75e270c6c..550b9aae8 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -28,9 +28,7 @@ <artifactId>tests-parent</artifactId> <name>Apache BookKeeper :: Tests</name> <modules> - <module>bookkeeper-server-shaded-artifact-test</module> - <module>bookkeeper-server-shaded-test</module> - <module>bookkeeper-server-tests-shaded-test</module> + <module>shaded</module> <module>docker-all-versions-image</module> <module>integration-tests-base</module> <module>integration-tests-base-groovy</module> diff --git a/tests/bookkeeper-server-shaded-test/pom.xml b/tests/shaded/bookkeeper-server-shaded-test/pom.xml similarity index 97% rename from tests/bookkeeper-server-shaded-test/pom.xml rename to tests/shaded/bookkeeper-server-shaded-test/pom.xml index d72d6caba..29f520bda 100644 --- a/tests/bookkeeper-server-shaded-test/pom.xml +++ b/tests/shaded/bookkeeper-server-shaded-test/pom.xml @@ -19,8 +19,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.apache.bookkeeper.tests</groupId> - <artifactId>tests-parent</artifactId> + <groupId>org.apache.bookkeeper.tests.shaded</groupId> + <artifactId>shaded-tests-parent</artifactId> <version>4.7.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/tests/bookkeeper-server-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedJarTest.java b/tests/shaded/bookkeeper-server-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedJarTest.java similarity index 100% rename from tests/bookkeeper-server-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedJarTest.java rename to tests/shaded/bookkeeper-server-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedJarTest.java diff --git a/tests/bookkeeper-server-tests-shaded-test/pom.xml b/tests/shaded/bookkeeper-server-tests-shaded-test/pom.xml similarity index 97% rename from tests/bookkeeper-server-tests-shaded-test/pom.xml rename to tests/shaded/bookkeeper-server-tests-shaded-test/pom.xml index 5418f5a0b..6efa48fc9 100644 --- a/tests/bookkeeper-server-tests-shaded-test/pom.xml +++ b/tests/shaded/bookkeeper-server-tests-shaded-test/pom.xml @@ -19,8 +19,8 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.apache.bookkeeper.tests</groupId> - <artifactId>tests-parent</artifactId> + <groupId>org.apache.bookkeeper.tests.shaded</groupId> + <artifactId>shaded-tests-parent</artifactId> <version>4.7.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> diff --git a/tests/bookkeeper-server-tests-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerTestsShadedJarTest.java b/tests/shaded/bookkeeper-server-tests-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerTestsShadedJarTest.java similarity index 100% rename from tests/bookkeeper-server-tests-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerTestsShadedJarTest.java rename to tests/shaded/bookkeeper-server-tests-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerTestsShadedJarTest.java diff --git a/tests/bookkeeper-server-shaded-artifact-test/pom.xml b/tests/shaded/distributedlog-core-shaded-test/pom.xml similarity index 68% rename from tests/bookkeeper-server-shaded-artifact-test/pom.xml rename to tests/shaded/distributedlog-core-shaded-test/pom.xml index 73352afba..5af667fbd 100644 --- a/tests/bookkeeper-server-shaded-artifact-test/pom.xml +++ b/tests/shaded/distributedlog-core-shaded-test/pom.xml @@ -19,33 +19,56 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <parent> - <groupId>org.apache.bookkeeper.tests</groupId> - <artifactId>tests-parent</artifactId> + <groupId>org.apache.bookkeeper.tests.shaded</groupId> + <artifactId>shaded-tests-parent</artifactId> <version>4.7.0-SNAPSHOT</version> <relativePath>..</relativePath> </parent> - <artifactId>bookkeeper-server-shaded-artifact-test</artifactId> - <name>Apache BookKeeper :: Tests :: bookkeeper-server shaded artifact test</name> + <artifactId>distributedlog-core-shaded-test</artifactId> + <name>Apache BookKeeper :: Tests :: distributedlog-core-shaded test</name> <dependencies> <dependency> - <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-server</artifactId> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-core-shaded</artifactId> <version>${project.version}</version> - <classifier>shaded</classifier> <scope>test</scope> + <!-- when running `mvn install` in the whole project, + it will still reference none dependency-reduced + pom file. so exclude these dependencies explicitly + to verify protobuf and guava classes have been relocated --> <exclusions> <exclusion> <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-common</artifactId> + <artifactId>bookkeeper-server</artifactId> </exclusion> <exclusion> - <groupId>org.apache.bookkeeper</groupId> - <artifactId>bookkeeper-proto</artifactId> + <groupId>org.apache.bookkeeper.http</groupId> + <artifactId>bookkeeper-http</artifactId> </exclusion> <exclusion> <groupId>org.apache.bookkeeper</groupId> <artifactId>circe-checksum</artifactId> </exclusion> + <exclusion> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-common</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.distributedlog</groupId> + <artifactId>distributedlog-protocol</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.zookeeper</groupId> + <artifactId>zookeeper</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.thrift</groupId> + <artifactId>libthrift</artifactId> + </exclusion> </exclusions> </dependency> </dependencies> diff --git a/tests/bookkeeper-server-shaded-artifact-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedArtifactTest.java b/tests/shaded/distributedlog-core-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/DistributedLogCoreShadedJarTest.java similarity index 64% rename from tests/bookkeeper-server-shaded-artifact-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedArtifactTest.java rename to tests/shaded/distributedlog-core-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/DistributedLogCoreShadedJarTest.java index 80e2d0c67..8bb48cd98 100644 --- a/tests/bookkeeper-server-shaded-artifact-test/src/test/java/org/apache/bookkeeper/tests/shaded/BookKeeperServerShadedArtifactTest.java +++ b/tests/shaded/distributedlog-core-shaded-test/src/test/java/org/apache/bookkeeper/tests/shaded/DistributedLogCoreShadedJarTest.java @@ -23,9 +23,9 @@ import org.junit.Test; /** - * Test whether the shaded artifact of `bookkeeper-server` is generated correctly. + * Test whether the distributedlog-core-shaded jar is generated correctly. */ -public class BookKeeperServerShadedArtifactTest { +public class DistributedLogCoreShadedJarTest { @Test(expected = ClassNotFoundException.class) public void testProtobufIsShaded() throws Exception { @@ -34,7 +34,7 @@ public void testProtobufIsShaded() throws Exception { @Test public void testProtobufShadedPath() throws Exception { - Class.forName("org.apache.bookkeeper.shaded.com.google.protobuf.Message"); + Class.forName("dlshade.com.google.protobuf.Message"); } @Test(expected = ClassNotFoundException.class) @@ -44,10 +44,20 @@ public void testGuavaIsShaded() throws Exception { @Test public void testGuavaShadedPath() throws Exception { - Class.forName("org.apache.bookkeeper.shaded.com.google.common.cache.Cache"); + Class.forName("dlshade.com.google.common.cache.Cache"); assertTrue(true); } + @Test(expected = ClassNotFoundException.class) + public void testZooKeeperIsShaded() throws Exception { + Class.forName("org.apache.zookeeper.ZooKeeper"); + } + + @Test + public void testZooKeeperShadedPath() throws Exception { + Class.forName("dlshade.org.apache.zookeeper.ZooKeeper"); + } + @Test public void testBookKeeperCommon() throws Exception { Class.forName("org.apache.bookkeeper.util.OrderedSafeExecutor"); @@ -65,4 +75,22 @@ public void testCirceChecksum() throws Exception { Class.forName("com.scurrilous.circe.checksum.Crc32cIntChecksum"); assertTrue(true); } + + @Test + public void testDistributedLogCommon() throws Exception { + Class.forName("org.apache.distributedlog.common.concurrent.AsyncSemaphore"); + assertTrue(true); + } + + @Test + public void testDistributedLogProto() throws Exception { + Class.forName("org.apache.distributedlog.DLSN"); + assertTrue(true); + } + + @Test + public void testDistributedLogCore() throws Exception { + Class.forName("org.apache.distributedlog.api.AsyncLogReader"); + assertTrue(true); + } } diff --git a/tests/shaded/pom.xml b/tests/shaded/pom.xml new file mode 100644 index 000000000..bb9855435 --- /dev/null +++ b/tests/shaded/pom.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + 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"> + <packaging>pom</packaging> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.bookkeeper.tests</groupId> + <artifactId>tests-parent</artifactId> + <version>4.7.0-SNAPSHOT</version> + <relativePath>..</relativePath> + </parent> + <groupId>org.apache.bookkeeper.tests.shaded</groupId> + <artifactId>shaded-tests-parent</artifactId> + <name>Apache BookKeeper :: Tests :: Test Shaded Jars</name> + <modules> + <module>bookkeeper-server-shaded-test</module> + <module>bookkeeper-server-tests-shaded-test</module> + <module>distributedlog-core-shaded-test</module> + </modules> +</project> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services