Repository: incubator-ratis Updated Branches: refs/heads/master 151c2aeed -> 6a2c3d58d
RATIS-288. Pom cleanup/simplification. Contributed by Josh Elser Project: http://git-wip-us.apache.org/repos/asf/incubator-ratis/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ratis/commit/6a2c3d58 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ratis/tree/6a2c3d58 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ratis/diff/6a2c3d58 Branch: refs/heads/master Commit: 6a2c3d58df27efaa10bc00c7c8a76730ef8bde64 Parents: 151c2ae Author: Tsz Wo Nicholas Sze <[email protected]> Authored: Tue Aug 7 14:37:05 2018 -0700 Committer: Tsz Wo Nicholas Sze <[email protected]> Committed: Tue Aug 7 14:37:05 2018 -0700 ---------------------------------------------------------------------- .gitignore | 2 - BUILDING.md | 42 ++-- pom.xml | 30 ++- ratis-assembly/pom.xml | 1 - ratis-client/pom.xml | 1 - ratis-common/pom.xml | 3 +- ratis-examples/pom.xml | 38 +-- ratis-hadoop-shaded/.gitignore | 2 - ratis-hadoop-shaded/pom.xml | 307 +++++------------------ ratis-proto-shaded/.gitignore | 2 - ratis-proto-shaded/pom.xml | 478 +++++++----------------------------- 11 files changed, 203 insertions(+), 703 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/.gitignore ---------------------------------------------------------------------- diff --git a/.gitignore b/.gitignore index 2608160..bab2050 100644 --- a/.gitignore +++ b/.gitignore @@ -9,11 +9,9 @@ *.suo *.vcxproj.user .idea -.svn .classpath .project .settings target build patchprocess -dependency-reduced-pom.xml http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/BUILDING.md ---------------------------------------------------------------------- diff --git a/BUILDING.md b/BUILDING.md index e019eea..56b6556 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -19,7 +19,7 @@ It is required to have Maven 3.3.9 or later. Apache Ratis is written in Java 8. Therefore, it as well requires Java 8 or later. -Project could be built as a usual maven project: +Project could be built as a usual Maven project: ``` $ mvn clean package -DskipTests @@ -34,34 +34,39 @@ We shade protos, protobuf and other libraries such as Netty, gRPC, Guava and Had so that applications using Ratis may use protobuf and other libraries with versions different from the versions used here. -Ratis requires the shaded sources for compilation. -The generated sources are stored in the following directories. -``` -ratis-proto-shaded/src/main/java/ -ratis-hadoop-shaded/src/main/java/ -``` -They are not checked-in to git though. +_Note: RATIS-288 changes how the shaded artifacts are generated, removing them from the +source tree. Developers with local checkouts prior to this change will need to manually +remove the directories `ratis-proto-shaded/src/main/java` and +`ratis-hadoop-shaded/src/main/java`._ -By default protobuf compilation and shading are triggered at every build. To make more faster the -additional builds, you can turn them off: +By default, protobuf compilation and shaded jar creation are executed for every build. + +For developers who wish to skip protobuf generation and shaded jar creation because they +are aware that they have not been modified, they can be disabled with the `skipShade` property. ``` $ mvn package -DskipTests -DskipShade ``` -During the clean lifecycle all the shaded classes are also deleted. You can clean the -compiled files but keep the shaded classes with the following command: - +When the `skipShade` property is given, Maven will inspect your local Maven repository for +the most recent version of `ratis-proto-shaded` (or `ratis-hadoop-shaded`), reaching out to +Maven central when you have no local copy. You may need to run a `mvn install` prior to +attempting to use the `skipShade` property to ensure that you have a version of the artifact +available for your use. ``` -$ mvn clean -DskipCleanShade +$ mvn install -DskipTests ``` -Then, the unit tests can be run by the following commands. +For developers familiar with the `skipCleanShade` option, this is no longer necessary. Maven's +local repository is acting as a cache instead of the current working copy of your repository. +`mvn clean` can be used to safely clean all temporary build files, without impacting your +use of the `skipShade` option. +Unit tests can also be executed with the `skipShade` option: ``` -$ mvn -DskipShade test +$ mvn package -DskipShade ``` -## What are shaded? +## What packages are shaded? | Original packages | Shaded packages | | ------------------------------------|--------------------------------------------------------------| @@ -72,4 +77,5 @@ $ mvn -DskipShade test | `io.netty` | `org.apache.ratis.shaded.io.netty` | | `org.apache.hadoop.ipc.protobuf` | `org.apache.ratis.shaded.org.apache.hadoop.ipc.protobuf` | -The protos defined in this project are stored in the `org.apache.ratis.shaded.proto` package. +The compiled protocol-buffer definitions in this `ratis-proto-shaded` are stored in the +`org.apache.ratis.shaded.proto` Java package. http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 31ac6b2..c3fb15a 100644 --- a/pom.xml +++ b/pom.xml @@ -41,14 +41,12 @@ </licenses> <modules> - <module>ratis-proto-shaded</module> <module>ratis-common</module> <module>ratis-client</module> <module>ratis-server</module> <module>ratis-grpc</module> <module>ratis-netty</module> - <module>ratis-hadoop-shaded</module> <module>ratis-hadoop</module> <module>ratis-assembly</module> @@ -323,6 +321,12 @@ </dependency> <dependency> + <groupId>io.dropwizard.metrics</groupId> + <artifactId>metrics-core</artifactId> + <version>3.2.5</version> + </dependency> + + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> @@ -557,6 +561,13 @@ <groupId>org.apache.rat</groupId> <artifactId>apache-rat-plugin</artifactId> <version>${apache-rat-plugin.version}</version> + <!-- target/ should get picked up from Apache parent pom.. --> + <configuration> + <!-- Lets us define more exclusions in child-modules without overriding these --> + <excludes combine.children="append"> + <exclude>target/*</exclude> + </excludes> + </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> @@ -775,7 +786,8 @@ <artifactId>apache-rat-plugin</artifactId> <executions> <execution> - <phase>package</phase> + <!-- Execution at the validate lifecycle is good --> + <id>check-licenses</id> <goals> <goal>check</goal> </goals> @@ -785,5 +797,17 @@ </plugins> </build> </profile> + <profile> + <id>skipShade</id> + <activation> + <property> + <name>!skipShade</name> + </property> + </activation> + <modules> + <module>ratis-proto-shaded</module> + <module>ratis-hadoop-shaded</module> + </modules> + </profile> </profiles> </project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-assembly/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-assembly/pom.xml b/ratis-assembly/pom.xml index 62a83a7..126f1ab 100644 --- a/ratis-assembly/pom.xml +++ b/ratis-assembly/pom.xml @@ -21,7 +21,6 @@ </parent> <artifactId>ratis-assembly</artifactId> - <groupId>org.apache.ratis</groupId> <name>Apache Ratis Project Assembly</name> <packaging>pom</packaging> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-client/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-client/pom.xml b/ratis-client/pom.xml index 6b3ae2c..b12cb10 100644 --- a/ratis-client/pom.xml +++ b/ratis-client/pom.xml @@ -38,7 +38,6 @@ <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <scope>compile</scope> </dependency> </dependencies> </project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-common/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-common/pom.xml b/ratis-common/pom.xml index ff6ec40..3810074 100644 --- a/ratis-common/pom.xml +++ b/ratis-common/pom.xml @@ -25,8 +25,8 @@ <dependencies> <dependency> - <artifactId>ratis-proto-shaded</artifactId> <groupId>org.apache.ratis</groupId> + <artifactId>ratis-proto-shaded</artifactId> <scope>provided</scope> </dependency> @@ -53,7 +53,6 @@ <dependency> <groupId>io.dropwizard.metrics</groupId> <artifactId>metrics-core</artifactId> - <version>3.2.5</version> </dependency> </dependencies> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-examples/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-examples/pom.xml b/ratis-examples/pom.xml index 0c63883..877abbb 100644 --- a/ratis-examples/pom.xml +++ b/ratis-examples/pom.xml @@ -142,6 +142,7 @@ <goal>shade</goal> </goals> <configuration> + <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> @@ -181,41 +182,4 @@ </plugin> </plugins> </build> - <profiles> - <profile> - <id>clean-shade</id> - <activation> - <property> - <name>!skipCleanShade</name> - </property> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <executions> - <execution> - <id>shaded-clean</id> - <goals> - <goal>clean</goal> - </goals> - <phase>clean</phase> - <configuration> - <filesets> - <fileset> - <directory>.</directory> - <includes> - <include>dependency-reduced-pom.xml</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - </profiles> </project> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-hadoop-shaded/.gitignore ---------------------------------------------------------------------- diff --git a/ratis-hadoop-shaded/.gitignore b/ratis-hadoop-shaded/.gitignore deleted file mode 100644 index ce50505..0000000 --- a/ratis-hadoop-shaded/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -src/main/java -dependency-reduced-pom.xml http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-hadoop-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-hadoop-shaded/pom.xml b/ratis-hadoop-shaded/pom.xml index ba62721..57f4c6c 100644 --- a/ratis-hadoop-shaded/pom.xml +++ b/ratis-hadoop-shaded/pom.xml @@ -25,187 +25,120 @@ <properties> <maven.javadoc.skip>true</maven.javadoc.skip> - <!--The Default target dir--> - <classes.dir>${project.build.directory}/classes</classes.dir> - <!--The Default location for sources--> - <shaded.sources.dir>src/main/java</shaded.sources.dir> <!--Version of Hadoop to be shaded --> <shaded.hadoop.version>${hadoop.version}</shaded.hadoop.version> </properties> <build> - <!--I want to override these in profile so define them - with variables up here--> - <sourceDirectory>${shaded.sources.dir}</sourceDirectory> - <outputDirectory>${classes.dir}</outputDirectory> <plugins> <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <compilerArgs> - <!-- disable all javac warnings for shaded sources --> - <arg>-Xlint:none</arg> - <arg>-XDignore.symbol.file</arg> - </compilerArgs> - <showWarnings>false</showWarnings> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-checkstyle-plugin</artifactId> - <configuration> - <excludes>org/apache/ratis/shaded/**/*</excludes> - </configuration> - </plugin> - <!-- Make a jar and put the sources in the jar --> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-source-plugin</artifactId> - </plugin> - <plugin> <!--Make it so assembly:single does nothing in here--> <artifactId>maven-assembly-plugin</artifactId> <configuration> <skipAssembly>true</skipAssembly> </configuration> </plugin> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes> - <exclude>${shaded.sources.dir}/</exclude> - </excludes> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.--> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <versionRange>[3.1.1,)</versionRange> + <goals> + <goal>shade</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> </build> <dependencies> <dependency> - <artifactId>ratis-proto-shaded</artifactId> - <groupId>org.apache.ratis</groupId> - <scope>provided</scope> + <groupId>org.apache.hadoop</groupId> + <artifactId>hadoop-common</artifactId> + <version>${shaded.hadoop.version}</version> </dependency> - <dependency> - <groupId>com.google.protobuf</groupId> - <artifactId>protobuf-java</artifactId> - <version>${shaded.protobuf.version}</version> - <optional>true</optional> + <groupId>com.google.errorprone</groupId> + <artifactId>error_prone_annotations</artifactId> + <version>2.2.0</version> </dependency> <dependency> - <groupId>com.google.protobuf.nano</groupId> - <artifactId>protobuf-javanano</artifactId> - <version>${shaded.protobuf-javanano.version}</version> - <optional>true</optional> + <groupId>com.google.j2objc</groupId> + <artifactId>j2objc-annotations</artifactId> + <version>1.3</version> </dependency> - <dependency> - <groupId>org.apache.hadoop</groupId> - <artifactId>hadoop-common</artifactId> - <version>${shaded.hadoop.version}</version> - <optional>true</optional> + <groupId>org.codehaus.mojo</groupId> + <artifactId>animal-sniffer-annotations</artifactId> + <version>1.16</version> </dependency> </dependencies> <profiles> - <!-- Skip the tests in this module --> <profile> - <id>skip-shaded-tests</id> - <activation> - <property> - <name>skip-shaded-tests</name> - </property> - </activation> - <properties> - <surefire.skipFirstPart>true</surefire.skipFirstPart> - </properties> - </profile> - - <profile> - <id>clean-shade</id> + <id>compile-protobuf</id> + <!-- + Shade and drop the generated java files under target/shaded-sources. + Run this profile/step everytime you change proto + files or update the protobuf version. + --> <activation> <property> - <name>!skipCleanShade</name> + <name>!skipShade</name> </property> </activation> <build> <plugins> <plugin> - <artifactId>maven-clean-plugin</artifactId> + <artifactId>maven-jar-plugin</artifactId> <executions> <execution> - <id>shaded-clean</id> + <!-- Replace the "default" jar-plugin execution --> + <!-- This is a super-dirty hack to work around Yetus + PreCommit not using the package lifecycle phase --> + <id>default-jar</id> + <phase>process-classes</phase> <goals> - <goal>clean</goal> + <goal>jar</goal> </goals> - <phase>clean</phase> - <configuration> - <filesets> - <fileset> - <directory>${shaded.sources.dir}</directory> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>.</directory> - <includes> - <include>dependency-reduced-pom.xml</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> </execution> </executions> </plugin> - </plugins> - </build> - </profile> - - <profile> - <id>compile-protobuf</id> - <!-- - Shade and drop the generated java files under src/main/java. - --> - <activation> - <property> - <name>!skipShade</name> - </property> - </activation> - <properties> - <profile.id>compile-protobuf</profile.id> - <!--When the compile for this profile runs, make sure it makes jars that - can be related back to this shading profile. Give them a shading prefix. - --> - <jar.finalName>${profile.id}.${project.artifactId}-${project.version}</jar.finalName> - </properties> - <build> - <finalName>${jar.finalName}</finalName> - <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <executions> <execution> - <phase>process-resources</phase> + <phase>process-classes</phase> <goals> <goal>shade</goal> </goals> <configuration> <shadeSourcesContent>true</shadeSourcesContent> <createSourcesJar>true</createSourcesJar> - <shadedArtifactAttached>true</shadedArtifactAttached> + <!-- Replace the original artifact which is no good on its own --> + <shadedArtifactAttached>false</shadedArtifactAttached> + <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <relocations> <relocation> <pattern>com.google.protobuf</pattern> @@ -227,125 +160,19 @@ </filters> <artifactSet> - <excludes> - <exclude>org.apache.ratis:ratis-hadoop-shaded</exclude> - - <exclude>com.google.code.findbugs:jsr305</exclude> - <exclude>com.google.code.gson:gson</exclude> - <exclude>com.google.guava:guava</exclude> - <exclude>com.google.protobuf.nano:protobuf-javanano</exclude> - <exclude>com.google.protobuf:protobuf-java</exclude> - <exclude>com.google.re2j:re2j</exclude> - - <exclude>com.jamesmurty.utils:java-xmlbuilder</exclude> - <exclude>com.jcraft:jsch</exclude> - <exclude>com.nimbusds:nimbus-jose-jwt</exclude> - <exclude>com.sun.jersey:jersey-core</exclude> - <exclude>com.sun.jersey:jersey-json</exclude> - <exclude>com.sun.jersey:jersey-server</exclude> - <exclude>com.sun.jersey:jersey-servlet</exclude> - <exclude>com.sun.xml.bind:jaxb-impl</exclude> - <exclude>com.thoughtworks.paranamer:paranamer</exclude> - - <exclude>commons-beanutils:commons-beanutils-core</exclude> - <exclude>commons-beanutils:commons-beanutils</exclude> - <exclude>commons-cli:commons-cli</exclude> - <exclude>commons-codec:commons-codec</exclude> - <exclude>commons-collections:commons-collections</exclude> - <exclude>commons-configuration:commons-configuration</exclude> - <exclude>commons-digester:commons-digester</exclude> - <exclude>commons-io:commons-io</exclude> - <exclude>commons-lang:commons-lang</exclude> - <exclude>commons-logging:commons-logging</exclude> - <exclude>commons-net:commons-net</exclude> - - <exclude>io.netty:netty</exclude> - <exclude>javax.activation:activation</exclude> - <exclude>javax.servlet.jsp:jsp-api</exclude> - <exclude>javax.servlet:servlet-api</exclude> - <exclude>javax.ws.rs:jsr311-api</exclude> - <exclude>javax.xml.bind:jaxb-api</exclude> - <exclude>javax.xml.stream:stax-api</exclude> - <exclude>log4j:log4j</exclude> - <exclude>net.java.dev.jets3t:jets3t</exclude> - <exclude>net.jcip:jcip-annotations</exclude> - <exclude>net.minidev:json-smart</exclude> - - <exclude>org.apache.avro:avro</exclude> - <exclude>org.apache.commons:commons-compress</exclude> - <exclude>org.apache.commons:commons-math3</exclude> - <exclude>org.apache.curator:curator-client</exclude> - <exclude>org.apache.curator:curator-framework</exclude> - <exclude>org.apache.curator:curator-recipes</exclude> - <exclude>org.apache.hadoop:hadoop-annotations</exclude> - <exclude>org.apache.hadoop:hadoop-auth</exclude> - <exclude>org.apache.htrace:htrace-core4</exclude> - <exclude>org.apache.httpcomponents:httpclient</exclude> - <exclude>org.apache.httpcomponents:httpcore</exclude> - <exclude>org.apache.kerby:kerb-admin</exclude> - <exclude>org.apache.kerby:kerb-client</exclude> - <exclude>org.apache.kerby:kerb-common</exclude> - <exclude>org.apache.kerby:kerb-core</exclude> - <exclude>org.apache.kerby:kerb-crypto</exclude> - <exclude>org.apache.kerby:kerb-identity</exclude> - <exclude>org.apache.kerby:kerb-server</exclude> - <exclude>org.apache.kerby:kerb-simplekdc</exclude> - <exclude>org.apache.kerby:kerb-util</exclude> - <exclude>org.apache.kerby:kerby-asn1</exclude> - <exclude>org.apache.kerby:kerby-config</exclude> - <exclude>org.apache.kerby:kerby-pkix</exclude> - <exclude>org.apache.kerby:kerby-util</exclude> - <exclude>org.apache.zookeeper:zookeeper</exclude> - - <exclude>org.checkerframework:checker-compat-qual</exclude> - <exclude>org.codehaus.jackson:jackson-core-asl</exclude> - <exclude>org.codehaus.jackson:jackson-jaxrs</exclude> - <exclude>org.codehaus.jackson:jackson-mapper-asl</exclude> - <exclude>org.codehaus.jackson:jackson-xc</exclude> - <exclude>org.codehaus.jettison:jettison</exclude> - <exclude>org.mortbay.jetty:jetty-sslengine</exclude> - <exclude>org.mortbay.jetty:jetty-util</exclude> - <exclude>org.mortbay.jetty:jetty</exclude> - <exclude>org.slf4j:slf4j-api</exclude> - <exclude>org.slf4j:slf4j-log4j12</exclude> - <exclude>org.tukaani:xz</exclude> - <exclude>org.xerial.snappy:snappy-java</exclude> - <exclude>xmlenc:xmlenc</exclude> - </excludes> + <includes> + <!-- Must list explicitly, otherwise we pull in all of hadoop-common's + transitive dependencies. --> + <include>org.apache.hadoop:hadoop-common</include> + <include>com.google.j2objc:j2objc-annotations</include> + <include>com.google.errorprone:error_prone_annotations</include> + <include>org.codehaus.mojo:animal-sniffer-annotations</include> + </includes> </artifactSet> </configuration> </execution> </executions> </plugin> - <!--Now unpack the shaded jar made above so the shaded classes - are available to subsequent modules--> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack</id> - <phase>process-resources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> - <classifier>shaded-sources</classifier> - <type>jar</type> - <overWrite>true</overWrite> - <outputDirectory>${basedir}/${shaded.sources.dir}</outputDirectory> - <includes>**/*.java</includes> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> </profile> http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-proto-shaded/.gitignore ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/.gitignore b/ratis-proto-shaded/.gitignore deleted file mode 100644 index ce50505..0000000 --- a/ratis-proto-shaded/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -src/main/java -dependency-reduced-pom.xml http://git-wip-us.apache.org/repos/asf/incubator-ratis/blob/6a2c3d58/ratis-proto-shaded/pom.xml ---------------------------------------------------------------------- diff --git a/ratis-proto-shaded/pom.xml b/ratis-proto-shaded/pom.xml index 2b203fc..96daef8 100644 --- a/ratis-proto-shaded/pom.xml +++ b/ratis-proto-shaded/pom.xml @@ -27,8 +27,6 @@ <maven.javadoc.skip>true</maven.javadoc.skip> <!--The Default target dir--> <classes.dir>${project.build.directory}/classes</classes.dir> - <!--The Default location for sources--> - <shaded.sources.dir>src/main/java</shaded.sources.dir> <!--Version of grpc to be shaded --> <shaded.grpc.version>1.10.0</shaded.grpc.version> @@ -82,90 +80,94 @@ <skipAssembly>true</skipAssembly> </configuration> </plugin> - <plugin> - <groupId>org.apache.rat</groupId> - <artifactId>apache-rat-plugin</artifactId> - <configuration> - <excludes> - <exclude>${shaded.sources.dir}/</exclude> - </excludes> - </configuration> - <executions> - <execution> - <phase>package</phase> - <goals> - <goal>check</goal> - </goals> - </execution> - </executions> - </plugin> </plugins> + <pluginManagement> + <plugins> + <!--This plugin's configuration is used to store Eclipse m2e settings only. + It has no influence on the Maven build itself. --> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-shade-plugin</artifactId> + <versionRange>[3.1.1,)</versionRange> + <goals> + <goal>shade</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-antrun-plugin</artifactId> + <versionRange>[1.7,)</versionRange> + <goals> + <goal>run</goal> + </goals> + </pluginExecutionFilter> + <action> + <ignore/> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> </build> - <dependencyManagement> - <dependencies> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-all</artifactId> - <version>${shaded.netty.version}</version> - <type>pom</type> - <scope>import</scope> - </dependency> - </dependencies> - </dependencyManagement> - <dependencies> <dependency> <groupId>com.google.protobuf</groupId> <artifactId>protobuf-java</artifactId> <version>${shaded.protobuf.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.protobuf.nano</groupId> <artifactId>protobuf-javanano</artifactId> <version>${shaded.protobuf-javanano.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-netty</artifactId> <version>${shaded.grpc.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-protobuf</artifactId> <version>${shaded.grpc.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-stub</artifactId> <version>${shaded.grpc.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>io.grpc</groupId> <artifactId>grpc-context</artifactId> <version>${shaded.grpc.version}</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.auto</groupId> <artifactId>auto-common</artifactId> <version>0.10</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.auto.service</groupId> <artifactId>auto-service</artifactId> <version>1.0-rc4</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.auto.value</groupId> @@ -176,7 +178,6 @@ <groupId>com.google.auto.value</groupId> <artifactId>auto-value</artifactId> <version>1.6</version> - <scope>provided</scope> </dependency> <dependency> <groupId>com.google.guava</groupId> @@ -188,19 +189,16 @@ <groupId>com.google.code.findbugs</groupId> <artifactId>jsr305</artifactId> <version>3.0.2</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> <version>2.2.0</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.j2objc</groupId> <artifactId>j2objc-annotations</artifactId> <version>1.3</version> - <optional>true</optional> </dependency> <dependency> @@ -213,230 +211,74 @@ <groupId>org.codehaus.mojo</groupId> <artifactId>animal-sniffer-annotations</artifactId> <version>1.16</version> - <optional>true</optional> </dependency> <dependency> <groupId>io.netty</groupId> <artifactId>netty-all</artifactId> <version>${shaded.netty.version}</version> - <optional>true</optional> - </dependency> - - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-buffer</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-dns</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-haproxy</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-http</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-http2</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-memcache</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-mqtt</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-socks</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-codec-stomp</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-common</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-handler</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-handler-proxy</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-resolver</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-resolver-dns</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-transport</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>io.netty</groupId> - <artifactId>netty-transport-rxtx</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-transport-sctp</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-transport-udt</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - <dependency> - <groupId>io.netty</groupId> - <artifactId>netty-example</artifactId> - <version>${shaded.netty.version}</version> - <scope>compile</scope> - <optional>true</optional> - </dependency> - - <dependency> - <groupId>io.netty</groupId> <artifactId>netty-tcnative</artifactId> <version>${netty-tcnative.version}</version> <classifier>${os.detected.classifier}</classifier> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>org.jboss.marshalling</groupId> <artifactId>jboss-marshalling</artifactId> - <scope>compile</scope> - <optional>true</optional> + <version>1.4.11.Final</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> - <optional>true</optional> </dependency> <dependency> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> - <optional>true</optional> + <version>1.2</version> </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> <artifactId>log4j-api</artifactId> - <optional>true</optional> + <version>2.6.2</version> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> - <optional>true</optional> + <version>1.2.17</version> </dependency> <dependency> <groupId>com.jcraft</groupId> <artifactId>jzlib</artifactId> <version>1.1.3</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.ning</groupId> <artifactId>compress-lzf</artifactId> <version>1.0.3</version> - <optional>true</optional> </dependency> <dependency> <groupId>net.jpountz.lz4</groupId> <artifactId>lz4</artifactId> <version>1.3.0</version> - <optional>true</optional> </dependency> <dependency> <groupId>com.github.jponge</groupId> <artifactId>lzma-java</artifactId> <version>1.3</version> - <optional>true</optional> </dependency> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcpkix-jdk15on</artifactId> <version>1.54</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> <version>2.8.2</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> @@ -462,84 +304,25 @@ <groupId>com.fasterxml</groupId> <artifactId>aalto-xml</artifactId> <version>1.0.0</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-api</artifactId> <version>${io.opencensus.version}</version> - <scope>compile</scope> - <optional>true</optional> </dependency> <dependency> <groupId>io.opencensus</groupId> <artifactId>opencensus-contrib-grpc-metrics</artifactId> <version>${io.opencensus.version}</version> - <scope>compile</scope> - <optional>true</optional> </dependency> </dependencies> <profiles> - <!-- Skip the tests in this module --> - <profile> - <id>skip-shaded-tests</id> - <activation> - <property> - <name>skip-shaded-tests</name> - </property> - </activation> - <properties> - <surefire.skipFirstPart>true</surefire.skipFirstPart> - </properties> - </profile> - - <profile> - <id>clean-shade</id> - <activation> - <property> - <name>!skipCleanShade</name> - </property> - </activation> - <build> - <plugins> - <plugin> - <artifactId>maven-clean-plugin</artifactId> - <executions> - <execution> - <id>shaded-clean</id> - <goals> - <goal>clean</goal> - </goals> - <phase>clean</phase> - <configuration> - <filesets> - <fileset> - <directory>${shaded.sources.dir}</directory> - <followSymlinks>false</followSymlinks> - </fileset> - <fileset> - <directory>.</directory> - <includes> - <include>dependency-reduced-pom.xml</include> - </includes> - <followSymlinks>false</followSymlinks> - </fileset> - </filesets> - </configuration> - </execution> - </executions> - </plugin> - </plugins> - </build> - </profile> - <profile> <id>compile-protobuf</id> <!-- - Shade and drop the generated java files under src/main/java. + Shade and drop the generated java files under target/shaded-sources. Run this profile/step everytime you change proto files or update the protobuf version. --> @@ -549,21 +332,9 @@ </property> </activation> <properties> - <profile.id>compile-protobuf</profile.id> - <sources.dir>${project.build.directory}/protoc-generated-sources</sources.dir> - <classes.dir>${project.build.directory}/protoc-generated-classes</classes.dir> - <!--When the compile for this profile runs, make sure it makes jars that - can be related back to this shading profile. Give them a shading prefix. - --> - <jar.finalName>${profile.id}.${project.artifactId}-${project.version}</jar.finalName> </properties> <build> - <finalName>${jar.finalName}</finalName> <plugins> - <!-- - We are not cleaning the generated files from src/main/java since we do not check-in the - generated files there. - --> <plugin> <groupId>org.xolstice.maven.plugins</groupId> <artifactId>protobuf-maven-plugin</artifactId> @@ -571,7 +342,9 @@ <protocArtifact> com.google.protobuf:protoc:${shaded.protobuf.version}:exe:${os.detected.classifier} </protocArtifact> - <outputDirectory>src/main/java</outputDirectory> + <!-- Place these in a location that compiler-plugin is already looking --> + <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> + <!-- With multiple executions, this must be `false` otherwise we wipe out the previous execution --> <clearOutputDirectory>false</clearOutputDirectory> </configuration> <executions> @@ -580,7 +353,6 @@ <phase>generate-sources</phase> <goals> <goal>compile</goal> - <goal>test-compile</goal> </goals> </execution> <execution> @@ -588,7 +360,6 @@ <phase>generate-sources</phase> <goals> <goal>compile-custom</goal> - <goal>test-compile-custom</goal> </goals> <configuration> <pluginId>grpc-java</pluginId> @@ -600,24 +371,16 @@ </executions> </plugin> <plugin> - <artifactId>maven-antrun-plugin</artifactId> + <artifactId>maven-jar-plugin</artifactId> <executions> <execution> - <phase>generate-sources</phase> - <configuration> - <tasks> - <replace token="com.google." value="org.apache.ratis.shaded.com.google." - dir="src/main/java/org/apache/ratis/shaded/proto"> - <include name="**/*.java"/> - </replace> - <replace token="io.grpc." value="org.apache.ratis.shaded.io.grpc." - dir="src/main/java/org/apache/ratis/shaded/proto"> - <include name="**/*.java"/> - </replace> - </tasks> - </configuration> + <!-- Replace the "default" jar-plugin execution --> + <!-- This is a super-dirty hack to work around Yetus + PreCommit not using the package lifecycle phase --> + <id>default-jar</id> + <phase>process-classes</phase> <goals> - <goal>run</goal> + <goal>jar</goal> </goals> </execution> </executions> @@ -627,14 +390,16 @@ <artifactId>maven-shade-plugin</artifactId> <executions> <execution> - <phase>process-resources</phase> + <phase>process-classes</phase> <goals> <goal>shade</goal> </goals> <configuration> <shadeSourcesContent>true</shadeSourcesContent> <createSourcesJar>true</createSourcesJar> - <shadedArtifactAttached>true</shadedArtifactAttached> + <!-- Replace the original artifact which is no good on its own --> + <shadedArtifactAttached>false</shadedArtifactAttached> + <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation> <relocations> <relocation> <pattern>com.google.api</pattern> @@ -686,112 +451,35 @@ <pattern>io.opencensus</pattern> <shadedPattern>org.apache.ratis.shaded.io.opencensus</shadedPattern> </relocation> + <relocation> + <pattern>com.google.gson</pattern> + <shadedPattern>org.apache.ratis.shaded.com.google.gson</shadedPattern> + </relocation> </relocations> - <filters> - <filter> - <artifact>io.netty:netty-all</artifact> - <includes> - <include>io/netty/**</include> - </includes> - </filter> - </filters> - <artifactSet> - <excludes> - <exclude>org.apache.ratis:ratis-proto-shaded</exclude> - - <exclude>com.barchart.udt:barchart-udt-bundle</exclude> - <exclude>com.github.jponge:lzma-java</exclude> - - <exclude>com.google.code.findbugs:jsr305</exclude> - <exclude>com.google.auto:auto-common</exclude> - <exclude>com.google.auto.service:auto-service</exclude> - <exclude>com.google.auto.value:auto-value-annotations</exclude> - <exclude>com.google.errorprone:error_prone_annotations</exclude> - <exclude>com.google.code.gson:gson</exclude> - <exclude>com.google.j2objc:j2objc-annotations</exclude> - - <exclude>com.fasterxml:aalto-xml</exclude> - <exclude>com.jcraft:jzlib</exclude> - <exclude>com.ning:compress-lzf</exclude> - <exclude>com.squareup:javapoet</exclude> - <exclude>com.yammer.metrics:metrics-core</exclude> - <exclude>commons-logging:commons-logging</exclude> - - <exclude>io.netty:netty-buffer</exclude> - <exclude>io.netty:netty-codec-dns</exclude> - <exclude>io.netty:netty-codec-haproxy</exclude> - <exclude>io.netty:netty-codec-http2</exclude> - <exclude>io.netty:netty-codec-http</exclude> - <exclude>io.netty:netty-codec-memcache</exclude> - <exclude>io.netty:netty-codec-mqtt</exclude> - <exclude>io.netty:netty-codec-redis</exclude> - <exclude>io.netty:netty-codec-socks</exclude> - <exclude>io.netty:netty-codec-stomp</exclude> - <exclude>io.netty:netty-codec</exclude> - <exclude>io.netty:netty-common</exclude> - <exclude>io.netty:netty-example</exclude> - <exclude>io.netty:netty-handler-proxy</exclude> - <exclude>io.netty:netty-handler</exclude> - <exclude>io.netty:netty-resolver-dns</exclude> - <exclude>io.netty:netty-resolver</exclude> - <exclude>io.netty:netty-tcnative</exclude> - <exclude>io.netty:netty-transport-rxtx</exclude> - <exclude>io.netty:netty-transport-sctp</exclude> - <exclude>io.netty:netty-transport-udt</exclude> - <exclude>io.netty:netty-transport</exclude> - - <exclude>log4j:log4j</exclude> - <exclude>net.jpountz.lz4:lz4</exclude> - <exclude>org.apache.logging.log4j:log4j-api</exclude> - <exclude>org.bouncycastle:bcpkix-jdk15on</exclude> - <exclude>org.bouncycastle:bcprov-jdk15on</exclude> - <exclude>org.checkerframework:checker-compat-qual</exclude> - <exclude>org.codehaus.mojo:animal-sniffer-annotations</exclude> - <exclude>org.codehaus.woodstox:stax2-api</exclude> - <exclude>org.conscrypt:conscrypt-openjdk-uber</exclude> - <exclude>org.javassist:javassist</exclude> - <exclude>org.jboss.marshalling:jboss-marshalling</exclude> - <exclude>org.jctools:jctools-core</exclude> - <exclude>org.rxtx:rxtx</exclude> - <exclude>org.slf4j:slf4j-api</exclude> - </excludes> + <includes> + <include>com.google.api.grpc:proto-google-common-protos</include> + <include>com.google.code.gson:gson</include> + <include>com.google.guava:guava</include> + <include>com.google.protobuf.nano:protobuf-javanano</include> + <include>com.google.protobuf:protobuf-java-util</include> + <include>com.google.protobuf:protobuf-java</include> + <include>io.grpc:grpc-context</include> + <include>io.grpc:grpc-core</include> + <include>io.grpc:grpc-netty</include> + <include>io.grpc:grpc-protobuf-lite</include> + <include>io.grpc:grpc-protobuf</include> + <include>io.grpc:grpc-stub</include> + <include>io.netty:netty-all</include> + <include>io.opencensus:opencensus-api</include> + <include>io.opencensus:opencensus-contrib-grpc-metrics</include> + </includes> </artifactSet> </configuration> </execution> </executions> </plugin> - - <!--Now unpack the shaded jar made above so the shaded classes - are available to subsequent modules--> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>unpack</id> - <phase>process-resources</phase> - <goals> - <goal>unpack</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>${project.groupId}</groupId> - <artifactId>${project.artifactId}</artifactId> - <version>${project.version}</version> - <classifier>shaded-sources</classifier> - <type>jar</type> - <overWrite>true</overWrite> - <outputDirectory>${basedir}/${shaded.sources.dir}</outputDirectory> - <includes>**/*.java</includes> - </artifactItem> - </artifactItems> - </configuration> - </execution> - </executions> - </plugin> </plugins> </build> </profile>
