Skip to content

Support extracting Java version from pom.xml and build.gradle via java-version-file #1034

Description

@brunoborges

Summary: Support java-version-file with pom.xml, build.gradle, and build.gradle.kts so setup-java can infer the JDK version without requiring a separate version file.

Background: PR #441 attempted this but is now outdated/conflicted. The idea remains useful and should continue in a fresh implementation.

Proposed behavior: When java-version-file points to one of the supported build files, parse the configured Java target/version and resolve a setup-java compatible version range.

Initial file targets:

  • pom.xml
  • build.gradle
  • build.gradle.kts

Scope:

  • Re-implement on current main (do not reuse PR feat: added support to pom.xml and build.gradle #441 branch directly)
  • Add parser logic in current version-file flow
  • Add unit/e2e coverage for supported patterns
  • Update docs for java-version-file support matrix and precedence rules

Out of scope:

  • Changing cache behavior
  • Backporting old branch history

Reference: PR #441

Metadata

Metadata

Assignees

Labels

feature requestNew feature or request to improve the current logic
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions