From 1b5403cf7d906a22c20bd4f025566a2a5f895d44 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 6 Sep 2022 08:06:13 -0700 Subject: [PATCH] HBASE-27340 Artifacts with resolved profiles (#4740) (#4761) (Forward port from branch-2; simplified by the fact that there is no hadoop-2.0 profile on master branch) 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 profile in the sub-module make it so the flatten plugin can figure 'hadoop.version' definitively. (In master there is only the hadoop-3.0 profile). 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. Signed-off-by: Duo Zhang --- hbase-asyncfs/pom.xml | 16 ++-- hbase-balancer/pom.xml | 16 ++-- hbase-endpoint/pom.xml | 10 +-- hbase-examples/pom.xml | 16 ++-- hbase-hadoop-compat/pom.xml | 62 ++++++++------- hbase-http/pom.xml | 10 +-- hbase-mapreduce/pom.xml | 75 ++++++++++--------- hbase-procedure/pom.xml | 8 +- hbase-rest/pom.xml | 10 +-- hbase-server/pom.xml | 16 ++-- .../hbase-shaded-testing-util/pom.xml | 62 ++++++++------- pom.xml | 50 +++++++++++++ 12 files changed, 205 insertions(+), 146 deletions(-) diff --git a/hbase-asyncfs/pom.xml b/hbase-asyncfs/pom.xml index 7037eb35433..91dc0b0279f 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 @@ -206,6 +195,11 @@ hadoop-minicluster test + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-balancer/pom.xml b/hbase-balancer/pom.xml index c8ca3a9e937..614b3857b5a 100644 --- a/hbase-balancer/pom.xml +++ b/hbase-balancer/pom.xml @@ -58,14 +58,6 @@ org.apache.hbase hbase-client - - org.apache.hadoop - hadoop-hdfs-client - - - org.apache.hadoop - hadoop-hdfs - org.slf4j slf4j-api @@ -166,6 +158,14 @@ org.apache.hadoop hadoop-common + + org.apache.hadoop + hadoop-hdfs-client + + + org.apache.hadoop + hadoop-hdfs + diff --git a/hbase-endpoint/pom.xml b/hbase-endpoint/pom.xml index 2b56b81ca7a..1bea3c6cf53 100644 --- a/hbase-endpoint/pom.xml +++ b/hbase-endpoint/pom.xml @@ -138,11 +138,6 @@ test-jar test - - org.apache.hadoop - hadoop-minikdc - test - org.slf4j @@ -292,6 +287,11 @@ 3.6.2.Final test + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-examples/pom.xml b/hbase-examples/pom.xml index a6e0998d337..e1add9cb68a 100644 --- a/hbase-examples/pom.xml +++ b/hbase-examples/pom.xml @@ -150,17 +150,6 @@ mockito-core test - - org.apache.hadoop - hadoop-minikdc - test - - - bouncycastle - bcprov-jdk15 - - - org.bouncycastle bcprov-jdk15on @@ -336,6 +325,11 @@ + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-hadoop-compat/pom.xml b/hbase-hadoop-compat/pom.xml index 8c1e280aad5..46c47776045 100644 --- a/hbase-hadoop-compat/pom.xml +++ b/hbase-hadoop-compat/pom.xml @@ -67,32 +67,6 @@ org.apache.hbase.thirdparty hbase-shaded-miscellaneous - - org.apache.hadoop - hadoop-mapreduce-client-core - - - com.google.guava - guava - - - - - org.apache.hadoop - hadoop-common - - - org.slf4j - slf4j-api - - - - javax.activation - javax.activation-api - runtime - org.apache.commons commons-lang3 @@ -201,6 +175,42 @@ + + hadoop-3.0 + + + !hadoop.profile + + + + + org.apache.hadoop + hadoop-mapreduce-client-core + + + com.google.guava + guava + + + + + org.apache.hadoop + hadoop-common + + + org.slf4j + slf4j-api + + + + javax.activation + javax.activation-api + runtime + + + diff --git a/hbase-http/pom.xml b/hbase-http/pom.xml index 3c8ba421fa1..06071aa8acb 100644 --- a/hbase-http/pom.xml +++ b/hbase-http/pom.xml @@ -144,11 +144,6 @@ mockito-core test - - org.apache.hadoop - hadoop-minikdc - test - org.slf4j jcl-over-slf4j @@ -376,6 +371,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 b0f5cddcebb..fb486f645b2 100644 --- a/hbase-mapreduce/pom.xml +++ b/hbase-mapreduce/pom.xml @@ -159,41 +159,6 @@ compile true - - 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 @@ -246,6 +211,11 @@ log4j-1.2-api test + + org.bouncycastle + bcprov-jdk15on + test + @@ -312,6 +282,12 @@ org.apache.hadoop hadoop-hdfs + + org.apache.hadoop + hadoop-hdfs + test-jar + test + org.apache.hadoop @@ -324,6 +300,35 @@ + + org.apache.hadoop + hadoop-minikdc + 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 + + + diff --git a/hbase-procedure/pom.xml b/hbase-procedure/pom.xml index dcc07f0fc51..002d9690e08 100644 --- a/hbase-procedure/pom.xml +++ b/hbase-procedure/pom.xml @@ -115,10 +115,6 @@ log4j-slf4j-impl test - - org.apache.hadoop - hadoop-hdfs-client - @@ -178,6 +174,10 @@ org.apache.hadoop hadoop-common + + org.apache.hadoop + hadoop-hdfs-client + diff --git a/hbase-rest/pom.xml b/hbase-rest/pom.xml index b772d0a986d..9e16586c9b5 100644 --- a/hbase-rest/pom.xml +++ b/hbase-rest/pom.xml @@ -210,11 +210,6 @@ kerb-simplekdc test - - org.apache.hadoop - hadoop-minikdc - test - org.apache.kerby kerb-core @@ -457,6 +452,11 @@ org.apache.hadoop hadoop-auth + + org.apache.hadoop + hadoop-minikdc + test + diff --git a/hbase-server/pom.xml b/hbase-server/pom.xml index f00fba295e2..47d7681ea78 100644 --- a/hbase-server/pom.xml +++ b/hbase-server/pom.xml @@ -258,17 +258,6 @@ bcprov-jdk15on test - - org.apache.hadoop - hadoop-minikdc - test - - - bouncycastle - bcprov-jdk15 - - - org.apache.kerby kerb-client @@ -711,6 +700,11 @@ ${netty.hadoop.version} 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 c79623337c7..d3d35ee5cc5 100644 --- a/hbase-shaded/hbase-shaded-testing-util/pom.xml +++ b/hbase-shaded/hbase-shaded-testing-util/pom.xml @@ -32,31 +32,6 @@ Apache HBase - Shaded - Testing Util - - org.apache.hadoop - hadoop-common - ${hadoop.version} - 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 @@ -163,4 +138,41 @@ + + + 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 f1e6173d840..c3f6107d37c 100644 --- a/pom.xml +++ b/pom.xml @@ -2100,6 +2100,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 @@ -3364,6 +3390,10 @@ hadoop-mapreduce-client-core ${hadoop-three.version} + + com.google.guava + guava + com.sun.jersey jersey-core @@ -3424,6 +3454,22 @@ ${hadoop-three.version} test-jar + + 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 * @@ -3945,6 +3991,10 @@ org.slf4j slf4j-reload4j + + bouncycastle + bcprov-jdk15 +