Skip to content

Commit

Permalink
deps: unflatten 2x hadoop & shaded artifact deps (#4226)
Browse files Browse the repository at this point in the history
Change-Id: Iff035fa787814d9f297d9cd69706d8f12ac27ac8

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/java-bigtable-hbase/issues/new/choose) before writing your code!  That way we can discuss the change, evaluate designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the [samples format](
https://togithub.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
  • Loading branch information
igorbernstein2 authored Nov 3, 2023
1 parent 194d061 commit d32e540
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 210 deletions.
124 changes: 40 additions & 84 deletions bigtable-hbase-2.x-parent/bigtable-hbase-2.x-hadoop/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,17 @@ limitations under the License.
bigtable-hbase-2.x.
</description>

<properties>
<!-- define a property that can be ignored by renovate -->
<hbase2-hadoop-slf4j.version>1.7.30</hbase2-hadoop-slf4j.version>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>bigtable-hbase-2.x-shaded</artifactId>
<version>2.12.1-SNAPSHOT</version> <!-- {x-version-update:bigtable-client-parent:current} -->
<exclusions>
<!-- hbase-shaded-client will be replaced with hbase-client -->
<exclusion>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-shaded-client</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
</exclusion>

<!-- Workaround MNG-5899 & MSHADE-206. Maven >= 3.3.0 doesn't use the dependency reduced
pom.xml files when invoking the build from a parent project. So we have to manually exclude
Expand All @@ -58,6 +50,7 @@ limitations under the License.
<groupId>${project.groupId}</groupId>
<artifactId>bigtable-hbase-2.x</artifactId>
</exclusion>
<!-- TODO: remove this exclusion -->
<exclusion>
<groupId>com.google.cloud.bigtable</groupId>
<artifactId>bigtable-metrics-api</artifactId>
Expand All @@ -72,29 +65,13 @@ limitations under the License.
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase-client</artifactId>
<version>${hbase2.version}</version>
</dependency>

<!-- Manually promote dependencies: This is necessary to avoid flattening hbase-shaded-client's dependency tree -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>

<!-- unlike hbase-shaded-client, hbase-client depends on slf4j 1.6.1.
Which is older than the version requested by metrics-core. However,
metrics-core will work fine with the older version and we want to stay
compatible with hbase-client deps -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${hbase2-hadoop-slf4j.version}</version>
</dependency>

<!-- Test deps -->
<dependency>
<groupId>junit</groupId>
Expand All @@ -105,40 +82,37 @@ limitations under the License.
</dependencies>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce</id>
<!-- requireUpperBoundDeps, banDuplicateClasses -->
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>enforce-banned-deps</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<execution>
<id>enforce-version-consistency-slf4j</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>

<plugins>
<plugin>
<!-- disable google-cloud-shared-config enforcement checks because
hbase-client's dependency subtree doesn't follow the same rules and is
unable to be fixed here -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<!-- hbase-client doesnt align slf4j-api & slf4j-log4j -->
<execution>
<id>enforce-version-consistency-slf4j</id>
<configuration>
<skip>true</skip>
</configuration>
</execution>
<!-- This must be a drop in replacement for hbase-client, so can't
manage hbase's deps -->
<execution>
<id>enforce-banned-deps</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<skip>true</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand All @@ -152,14 +126,10 @@ limitations under the License.
<shadedArtifactAttached>false</shadedArtifactAttached>
<createDependencyReducedPom>true</createDependencyReducedPom>
<!-- Need to manually promote to dependencies to keep the structure of hbase-shade-client -->
<promoteTransitiveDependencies>
false
</promoteTransitiveDependencies>
<promoteTransitiveDependencies>false</promoteTransitiveDependencies>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<filters>
Expand All @@ -174,20 +144,9 @@ limitations under the License.
</filters>
<artifactSet>
<includes>
<include>
com.google.cloud.bigtable:bigtable-hbase-2.x-shaded
</include>
<include>com.google.cloud.bigtable:bigtable-hbase-2.x-shaded</include>
</includes>
</artifactSet>
<relocations>
<!-- Undo the relocation that hbase-shaded-client did to make it compatible with the regular hbase-client -->
<relocation>
<pattern>
org.apache.hadoop.hbase.shaded.com.google.protobuf
</pattern>
<shadedPattern>com.google.protobuf</shadedPattern>
</relocation>
</relocations>
</configuration>
</execution>
</executions>
Expand Down Expand Up @@ -226,20 +185,17 @@ limitations under the License.
</goals>
</execution>
<execution>
<id>verify-mirror-deps</id>
<id>verify-mirror-deps-hbase</id>
<phase>verify</phase>
<goals>
<goal>verify-mirror-deps</goal>
</goals>
<configuration>
<targetDependencies>
<targetDependency>org.apache.hbase:hbase-client:${hbase2.version}</targetDependency>
<targetDependency>org.apache.hbase:hbase-client</targetDependency>
</targetDependencies>
<ignoredDependencies>
<!-- There are 3 users of this dep: us, httpclient & hbase2.
httpclient requires a higher version than hbase, so for now,
we are using that version -->
<ignoredDependency>commons-logging:commons-logging</ignoredDependency>
<dependency>log4j:log4j</dependency>
</ignoredDependencies>
</configuration>
</execution>
Expand Down
Loading

0 comments on commit d32e540

Please sign in to comment.