You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ci: split enforcer into fast PR metadata check and release banDuplicateClasses check (#14142)
## Summary
Separates the Maven Enforcer configuration into two distinct executions:
1. **`enforce` (Fast Metadata Checks)**: Checks `requireUpperBoundDeps`,
`requireMavenVersion`, and `requireJavaVersion`. Runs on every PR
directly in memory (~15s) without needing a full-repo build.
2. **`enforce-banned-duplicate-classes` (Bytecode Scanner)**: Checks
`banDuplicateClasses`. Runs only on Release-Please (non-SNAPSHOT) PRs
after compiling and installing all module JARs to disk.
---
### Key Changes
* **`java-shared-config/pom.xml`**:
* Separated `<id>enforce</id>` into fast metadata rules
(`requireUpperBoundDeps`, `requireMavenVersion: [3.8.0,)`,
`requireJavaVersion: [1.8,)`).
* Added `<id>enforce-banned-duplicate-classes</id>` execution containing
the `<banDuplicateClasses>` rule.
* **`.github/workflows/ci.yaml`**:
* `enforcer` job: Runs on every PR using `mvn -B -ntp
enforcer:enforce@enforce -T 1C` (executes in ~15 seconds across all
modules without pre-installing JARs).
* `ban-duplicate-classes` job: Runs on Release-Please PRs
(`release-please--branches--main` non-SNAPSHOT) with the full `JOB_TYPE:
install` step followed by `mvn -B -ntp
enforcer:enforce@enforce-banned-duplicate-classes -T 1C`.
* **`grpc-gcp-java`**:
* Updated parent POM to inherit the local
`google-cloud-shared-config:1.21.0-SNAPSHOT` parent via relative path
and Release-Please tracking comment (`<!--
{x-version-update:google-cloud-shared-config:current} -->`), directly
inheriting the split enforcer configuration.
* **`google-auth-library-java`**:
* Added temporary enforcer configuration overrides with `<rules
combine.self="override">` to prevent running the old
`banDuplicateClasses` rule inherited from the remote
`google-cloud-shared-config:1.17.0` release artifact.
* *Note*: These overrides are temporary until the new version of
`google-cloud-shared-config` is published to Maven Central, at which
point the parent version will be bumped and the overrides removed.
* **`java-samples`**:
* Added `<enforcer.skip>true</enforcer.skip>` to sample parent POM.
---
### Benefits
* **Fast PR Turnaround**: Developers get immediate feedback on
dependency convergence (`requireUpperBoundDeps`) and tool versions in
~15 seconds rather than waiting 20+ minutes.
* **Full Classpath Safety**: Releases remain protected against duplicate
class conflicts (JAR hell) via `banDuplicateClasses` before publishing.
Copy file name to clipboardExpand all lines: google-auth-library-java/bom/pom.xml
+47Lines changed: 47 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -42,4 +42,51 @@
42
42
</dependency>
43
43
</dependencies>
44
44
</dependencyManagement>
45
+
46
+
<build>
47
+
<plugins>
48
+
<!-- Temporary enforcer configuration override until a new version of google-cloud-shared-config is released to Maven Central.
49
+
Because this module inherits a released version of google-cloud-shared-config from Central (which includes banDuplicateClasses in its default enforce execution),
50
+
we override the enforce execution here to avoid running banDuplicateClasses on standard PRs where intra-repo SNAPSHOT JARs are unbuilt.
51
+
Remove this override once the parent version is bumped to the newly released google-cloud-shared-config. -->
Copy file name to clipboardExpand all lines: google-auth-library-java/pom.xml
+42Lines changed: 42 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -278,6 +278,48 @@
278
278
</plugins>
279
279
</pluginManagement>
280
280
<plugins>
281
+
<!-- Temporary enforcer configuration override until a new version of google-cloud-shared-config is released to Maven Central.
282
+
Because this module inherits a released version of google-cloud-shared-config from Central (which includes banDuplicateClasses in its default enforce execution),
283
+
we override the enforce execution here to avoid running banDuplicateClasses on standard PRs where intra-repo SNAPSHOT JARs are unbuilt.
284
+
Remove this override once the parent version is bumped to the newly released google-cloud-shared-config. -->
0 commit comments