Skip to content

[main] Add transitive compileOnlyApi dependencies (#3450 port) - #4510

Open
guru-bharadwaj20 wants to merge 1 commit into
apache:mainfrom
guru-bharadwaj20:gh-3600-compile-only-api
Open

guru-bharadwaj20 wants to merge 1 commit into
apache:mainfrom
guru-bharadwaj20:gh-3600-compile-only-api

Conversation

@guru-bharadwaj20

Copy link
Copy Markdown

Ports #3450 to main, as asked in #3600.

The annotation libraries that log4j-parent declares with provided scope (bnd, Error Prone, JSpecify, OSGi bundle and versioning, SpotBugs) are now:

  • added as compileOnlyApi dependencies in the Gradle Module Metadata, through gradle-module-metadata-maven-plugin
  • listed in bnd-jpms-module-info, so bnd writes requires static for them in the generated module-info

I used the current 2.x version of the change, with plugin version 1.2. Unlike 2.x, main still depends on spotbugs-annotations, so it stays in both lists, as it was in the original #3450. JSpecify isn't in the module list because bnd already emits requires static org.jspecify on main.

What I checked, building log4j-core with ./mvnw -pl log4j-core -am install -DskipTests:

  • module-info.class of log4j-core now has requires static for biz.aQute.bnd.annotation, com.github.spotbugs.annotations, com.google.errorprone.annotations, org.osgi.annotation.bundle and org.osgi.annotation.versioning. A build of main without the change has none of them.
  • The generated log4j-core-3.0.0-SNAPSHOT.module lists the six libraries in apiElements and not in runtimeElements.
  • ./mvnw -pl log4j-parent,log4j-core spotless:check and ./mvnw -pl log4j-core -am verify -DskipTests pass.

Added a changelog entry in src/changelog/.3.x.x.

Fixes #3600

…pache#3450 port)

Port of apache#3450 to main. The annotation libraries that log4j-parent declares with
provided scope are now added as compileOnlyApi dependencies in the Gradle Module
Metadata and as 'requires static' directives in the generated module-info.

Fixes apache#3600
Copilot AI balanced review requested due to automatic review settings November 20, 2026 13:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@ramanathan1504 ramanathan1504 added bug Incorrect, unexpected, or unintended behavior of existing code build Affects the build system or other automation port-done No further port needed: all required ports are merged, or none was needed labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Incorrect, unexpected, or unintended behavior of existing code build Affects the build system or other automation port-done No further port needed: all required ports are merged, or none was needed

Projects

Development

Successfully merging this pull request may close these issues.

3 participants