From 11ebb7478370b3a1756f0ba7a9c1df2aff54c415 Mon Sep 17 00:00:00 2001 From: stack Date: Wed, 31 Aug 2022 19:01:23 -0700 Subject: [PATCH] HBASE-27340 Artifacts with resolved profiles Make it so our published poms carry the minimum needed to run an hbase; the published pom has no profiles -- the profiles specified at build time are resolved, their dependencies inlined, and then they are stripped -- and no build-time, or plugins dependencies or properties, etc. Resultant poms have explicit hadoop lib versions baked in -- no more being able to choose hbase with hadoop2 or haddop3 at downstream build time by setting a '-Dhadoop.profile=X.0'. Pattern is to add profiles when none in sub-modules when the flatten plugin complains it can't resolve an hadoop dependency's 'version' (e.g. hadoop-common, hadoop-hdfs). Adding the hadoop-2.0 and hadoop-3.0 profiles in the sub-module make it so the flatten plugin can figure 'hadoop.version' definitively. Another spin on the above happens when profiles already exist in submodule but the flatten plugin is complaining it can't figure figure version on an hadoop dependency NOT under profiles. Below, we move the delinquent hadoop dependency under existing profiles (minikdc was the usual dependency outside profiles in sub-modules that flatten complained about). Sometimes, moving an hadoop dependency under a profile, there would be excludes on the local dependency. If the parent pom excludes section was missing the local excludes, we added them up to the parent module so all excluding is done up there in the parent profile dependencyManagement section. * hbase-asyncfs/pom.xml * hbase-endpoint/pom.xml * hbase-examples/pom.xml * hbase-http/pom.xml * hbase-rest/pom.xml * hbase-server/pom.xml Move the minikdc under profiles so it picks up appropriate hadoop version when the flatten plugin runs. * hbase-hadoop2-compat/pom.xml Add hadoop2 and hadoop3 profiles and move hadoop-common, etc. under them so we pick up appropriate hadoop version when flatten plugin runs. * hbase-mapreduce/pom.xml Move hadoop dependencies under profiles so right version is available when the flatten plugin runs. * hbase-shaded/hbase-shaded-testing-util/pom.xml Add profiles for hadoop-2.0 and hadoop-3.0 and move the hadoop dependencies under them. pom.xml Add the flatten plugin with the flatten profiles enabled. Add a few excludes on hadoop profiles picked up from sub-modules. E.g. exclude bouncycastle bcprov-jdk15 when we include minikdc. --- hbase-asyncfs/pom.xml | 21 ++- hbase-endpoint/pom.xml | 15 +- hbase-examples/pom.xml | 21 ++- hbase-hadoop2-compat/pom.xml | 67 +++++--- hbase-http/pom.xml | 15 +- hbase-mapreduce/pom.xml | 144 +++++++++++------- hbase-rest/pom.xml | 15 +- hbase-server/pom.xml | 21 ++- .../hbase-shaded-testing-util/pom.xml | 101 +++++++++--- pom.xml | 74 ++++++++- 10 files changed, 344 insertions(+), 150 deletions(-) diff --git a/hbase-asyncfs/pom.xml b/hbase-asyncfs/pom.xml index 58e50085afac..32cc1a4c373f 100644 --- a/hbase-asyncfs/pom.xml +++ b/hbase-asyncfs/pom.xml @@ -78,17 +78,6 @@ bcprov-jdk15on test - - org.apache.hadoop - hadoop-minikdc - test - - - bouncycastle - bcprov-jdk15 - - - org.apache.kerby kerb-client @@ -204,6 +193,11 @@ hadoop-minicluster test + + org.apache.hadoop + hadoop-minikdc + test + org.slf4j @@ -349,6 +344,11 @@ ${netty.hadoop.version} test + + org.apache.hadoop + hadoop-minikdc + test + javax.activation javax.activation-api + ${javax.activation.version} runtime @@ -198,6 +177,50 @@ limitations under the License. + + + hadoop-2.0 + + + + + !hadoop.profile + + + + + org.apache.hadoop + hadoop-common + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + + + + hadoop-3.0 + + + hadoop.profile + 3.0 + + + + + org.apache.hadoop + hadoop-common + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + skipHadoopTwoCompatTests diff --git a/hbase-http/pom.xml b/hbase-http/pom.xml index a442abf5d5ff..1a1d44d5fdb8 100644 --- a/hbase-http/pom.xml +++ b/hbase-http/pom.xml @@ -131,11 +131,6 @@ mockito-core test - - org.apache.hadoop - hadoop-minikdc - test - org.slf4j jcl-over-slf4j @@ -372,6 +367,11 @@ jackson-core-asl 1.9.13 + + org.apache.hadoop + hadoop-minikdc + test + @@ -437,6 +437,11 @@ com.fasterxml.jackson.core jackson-core + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-mapreduce/pom.xml b/hbase-mapreduce/pom.xml index 1ebe13970173..01a76dff78eb 100644 --- a/hbase-mapreduce/pom.xml +++ b/hbase-mapreduce/pom.xml @@ -183,59 +183,6 @@ compile true - - org.apache.hadoop - hadoop-common - - - org.apache.hadoop - hadoop-hdfs - - - org.apache.hadoop - hadoop-mapreduce-client-core - - - - org.apache.hadoop - hadoop-minicluster - test - - - org.apache.hadoop - hadoop-mapreduce-client-jobclient - test-jar - test - - - org.codehaus.jackson - jackson-mapper-asl - - - org.codehaus.jackson - jackson-core-asl - - - javax.xml.bind - jaxb-api - - - javax.ws.rs - jsr311-api - - - - - org.apache.hadoop - hadoop-hdfs - test-jar - test - - - org.apache.hadoop - hadoop-minikdc - test - org.mockito mockito-core @@ -288,6 +235,11 @@ log4j-1.2-api test + + org.bouncycastle + bcprov-jdk15on + test + @@ -355,8 +307,92 @@ ${netty.hadoop.version} test + + org.apache.hadoop + hadoop-minikdc + test + + + org.apache.hadoop + hadoop-common + + + org.apache.hadoop + hadoop-hdfs + + + org.apache.hadoop + hadoop-hdfs + test-jar + test + + + + org.apache.hadoop + hadoop-minicluster + test + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + org.apache.hadoop + hadoop-mapreduce-client-jobclient + test-jar + test + + + + + + hadoop-3.0 + + + hadoop.profile + 3.0 + + + + + org.apache.hadoop + hadoop-minikdc + test + + + org.apache.hadoop + hadoop-common + + + org.apache.hadoop + hadoop-hdfs + + + org.apache.hadoop + hadoop-hdfs + test-jar + test + + + + org.apache.hadoop + hadoop-minicluster + test + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + org.apache.hadoop + hadoop-mapreduce-client-jobclient + test-jar + test + - eclipse-specific diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index 24fb3a9e78b5..2805c6e6c32d 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -211,11 +211,6 @@ kerb-simplekdc test - - org.apache.hadoop - hadoop-minikdc - test - org.apache.kerby kerb-core @@ -443,6 +438,11 @@ org.apache.hadoop hadoop-auth + + org.apache.hadoop + hadoop-minikdc + test + + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-shaded/hbase-shaded-testing-util/pom.xml b/hbase-shaded/hbase-shaded-testing-util/pom.xml index 7421b5da9b05..2b3784e136b5 100644 --- a/hbase-shaded/hbase-shaded-testing-util/pom.xml +++ b/hbase-shaded/hbase-shaded-testing-util/pom.xml @@ -32,30 +32,6 @@ - - org.apache.hadoop - hadoop-common - test-jar - compile - - - org.apache.hadoop - hadoop-hdfs - test-jar - compile - - - org.apache.hadoop - hadoop-mapreduce-client-app - test-jar - compile - - - org.apache.hadoop - hadoop-mapreduce-client-jobclient - test-jar - compile - org.apache.hbase hbase-common @@ -175,4 +151,81 @@ + + + hadoop-2.0 + + + + + !hadoop.profile + + + + + org.apache.hadoop + hadoop-common + test-jar + compile + + + org.apache.hadoop + hadoop-hdfs + test-jar + compile + + + org.apache.hadoop + hadoop-mapreduce-client-app + test-jar + compile + + + org.apache.hadoop + hadoop-mapreduce-client-jobclient + test-jar + compile + + + + + + hadoop-3.0 + + + hadoop.profile + 3.0 + + + + + org.apache.hadoop + hadoop-common + test-jar + compile + + + org.apache.hadoop + hadoop-hdfs + test-jar + compile + + + org.apache.hadoop + hadoop-mapreduce-client-app + test-jar + compile + + + org.apache.hadoop + hadoop-mapreduce-client-jobclient + test-jar + compile + + + + diff --git a/pom.xml b/pom.xml index c134c59f9a32..5379e47fe433 100644 --- a/pom.xml +++ b/pom.xml @@ -712,6 +712,7 @@ none + 1.2.0 @@ -1882,6 +1883,32 @@ + + org.codehaus.mojo + flatten-maven-plugin + 1.3.0 + + true + + + + + flatten + + flatten + + process-resources + + + + flatten.clean + + clean + + clean + + + org.codehaus.mojo build-helper-maven-plugin @@ -3148,6 +3175,22 @@ hadoop-mapreduce-client-jobclient ${hadoop-two.version} + + org.codehaus.jackson + jackson-mapper-asl + + + org.codehaus.jackson + jackson-core-asl + + + javax.xml.bind + jaxb-api + + + javax.ws.rs + jsr311-api + com.sun.jersey jersey-core @@ -3585,7 +3628,7 @@ --> javax.activation javax.activation-api - 1.2.0 + ${javax.activation.version} test @@ -3698,6 +3741,10 @@ org.slf4j slf4j-reload4j + + bouncycastle + bcprov-jdk15 + @@ -3711,7 +3758,6 @@ hadoop-distcp ${hadoop-two.version} - org.apache.hadoop hadoop-hdfs-client @@ -3753,6 +3799,10 @@ hadoop-mapreduce-client-core ${hadoop-three.version} + + com.google.guava + guava + com.sun.jersey jersey-core @@ -3812,6 +3862,22 @@ hadoop-mapreduce-client-jobclient ${hadoop-three.version} + + org.codehaus.jackson + jackson-mapper-asl + + + org.codehaus.jackson + jackson-core-asl + + + javax.xml.bind + jaxb-api + + + javax.ws.rs + jsr311-api + org.codehaus.jackson * @@ -4354,6 +4420,10 @@ org.slf4j slf4j-reload4j + + bouncycastle + bcprov-jdk15 +