Skip to content

[java] stop shipping annotation-only jars as POM dependencies - #18212

Merged
titusfortner merged 1 commit into
SeleniumHQ:trunkfrom
titusfortner:pom-annotation-deps
Oct 20, 2026
Merged

titusfortner merged 1 commit into
SeleniumHQ:trunkfrom
titusfortner:pom-annotation-deps

Conversation

@titusfortner

Copy link
Copy Markdown
Member

💥 What does this PR do?

  • Removes annotations from published Java POM; annotations have class retention, so nothing needs them at runtime.

🔧 Implementation Notes

  • rules_jvm_external maps Bazel deps to Maven runtime scope and exports to compile scope, and //java:auto-service exports the annotations artifact, so every consumer carried it (runtime in eleven modules, compile in selenium-remote-driver). Tagging that target maven:compile_only uses the ruleset's stop tag; the exported annotation processor still runs, and the META-INF/services entries in the chrome, firefox and remote jars are unchanged.
  • The seven BiDi subpackages listed the annotations artifact directly, but none of them uses @AutoService.
  • selenium-firefox-driver's direct dep on the bidi library was the only thing putting org.jetbrains:annotations in its POM; FirefoxDriver reaches those classes through selenium-remote-driver's exports, as ChromiumDriver already does. It stays at compile scope in selenium-remote-driver, where ApiStatus is useful to IDEs.

🤖 AI assistance

  • AI assisted (complete below)
    • Tool(s): Claude Code (Fable 5.1)
    • What was generated: the POM analysis, the fix, and this description
    • I reviewed all AI output and can explain the change

🔄 Types of changes

  • Cleanup (formatting, renaming)

@selenium-ci

Copy link
Copy Markdown
Member

/agentic_describe

@selenium-ci

Copy link
Copy Markdown
Member

/agentic_review

@selenium-ci selenium-ci added C-java Java Bindings B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related labels Oct 20, 2026
@qodo-code-review

qodo-code-review Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Remove annotation-only dependencies from published Java POMs

🐞 Bug fix ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Stop publishing AutoService annotations as transitive Java POM dependencies while retaining
 annotation processing.
• Remove unused annotation dependencies from seven BiDi packages.
• Rely on remote-driver exports for Firefox’s BiDi classes, avoiding an unnecessary POM dependency.
Diagram

graph TD
  ANN["AutoService annotations"] --> AS["Auto-service target"] --> STOP["Compile-only boundary"] --> POM["Published POMs"]
  BIDI["BiDi packages"] --> REM["Remote driver"] --> POM
  FF["Firefox driver"] --> REM
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Filter annotations centrally during POM generation
  • ➕ Could enforce a consistent annotation-dependency policy across all published modules.
  • ➖ Changes publishing behavior globally and may hide annotations that consumers need at compile time.

Recommendation: Keep the targeted Bazel dependency changes. The existing compile-only tag provides the needed publishing boundary without altering global POM generation, while removing unused dependencies at their source.

Files changed (9) +1 / -13

Bug fix (2) +1 / -1
BUILD.bazelMake the auto-service target compile-only for Maven publishing +1/-0

Make the auto-service target compile-only for Maven publishing

• Adds the Maven compile-only tag to the target that exports AutoService annotations and the annotation processor. This stops its annotation dependency from propagating into published POMs without removing annotation processing.

java/BUILD.bazel

BUILD.bazelRemove Firefox’s redundant direct BiDi dependency +0/-1

Remove Firefox’s redundant direct BiDi dependency

• Removes the direct BiDi dependency from the Firefox driver; remote-driver exports still provide those classes. This avoids bringing the BiDi library’s annotation dependency into Firefox’s POM.

java/src/org/openqa/selenium/firefox/BUILD.bazel

Other (7) +0 / -12
BUILD.bazelRemove unused browser-package AutoService annotations +0/-1

Remove unused browser-package AutoService annotations

• Drops the direct AutoService annotations dependency from the BiDi browser library.

java/src/org/openqa/selenium/bidi/browser/BUILD.bazel

BUILD.bazelRemove unused browsing-context AutoService annotations +0/-2

Remove unused browsing-context AutoService annotations

• Drops the direct annotations dependency and its now-unused artifact-rule load.

java/src/org/openqa/selenium/bidi/browsingcontext/BUILD.bazel

BUILD.bazelRemove unused module-package AutoService annotations +0/-2

Remove unused module-package AutoService annotations

• Drops the direct annotations dependency and its now-unused artifact-rule load.

java/src/org/openqa/selenium/bidi/module/BUILD.bazel

BUILD.bazelRemove unused network-package AutoService annotations +0/-2

Remove unused network-package AutoService annotations

• Drops the direct annotations dependency and its now-unused artifact-rule load.

java/src/org/openqa/selenium/bidi/network/BUILD.bazel

BUILD.bazelRemove unused script-package AutoService annotations +0/-1

Remove unused script-package AutoService annotations

• Drops the direct AutoService annotations dependency while retaining the other artifact dependencies.

java/src/org/openqa/selenium/bidi/script/BUILD.bazel

BUILD.bazelRemove unused storage-package AutoService annotations +0/-2

Remove unused storage-package AutoService annotations

• Drops the direct annotations dependency and its now-unused artifact-rule load.

java/src/org/openqa/selenium/bidi/storage/BUILD.bazel

BUILD.bazelRemove unused web-extension AutoService annotations +0/-2

Remove unused web-extension AutoService annotations

• Drops the direct annotations dependency and its now-unused artifact-rule load.

java/src/org/openqa/selenium/bidi/webextension/BUILD.bazel

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can open the rule or relationship behind a finding in one click

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@titusfortner
titusfortner merged commit 32c5bf9 into SeleniumHQ:trunk Oct 20, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

B-build Includes scripting, bazel and CI integrations B-devtools Includes everything BiDi or Chrome DevTools related C-java Java Bindings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants