Enhancement: fall back to `.java-version`, `.sdkmanrc`, and `.tool-versions` for the Java runtime

Đang mở
#711 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
75/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java, typescript

Hướng nghiên cứu

Read src/core-open/scanners/java-scanner.ts around the Java version detection at lines 187–196 and 557–570, then inspect the Gradle and Kotlin toolchain tests named in the issue. Add coverage for each pin file, precedence, and skipped values; done means pin files supply Java 17 when the build has no version while Gradle or POM versions still take precedence.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement good first issue
  • Difficulty: small to medium
  • Area: Java / Maven / Gradle
Problem

The Java runtime comes only from POM properties (java.version, maven.compiler.source / target / release, …) and from Gradle sourceCompatibility, JavaLanguageVersion.of(N), and jvmToolchain(N) (src/core-open/scanners/java-scanner.ts, around lines 187–196 and 557–570). A Maven or Gradle project that pins the JDK only with jenv, SDKMAN, or asdf reports no runtime:

# .java-version
17

# .sdkmanrc
java=17.0.10-tem

# .tool-versions
java temurin-17.0.10

#658 (maven-compiler-plugin <release> / <source>) stays a separate issue and should still win when it is implemented, because it is declared in the build file.

Expected behaviour

When the POM or Gradle build has not set a Java version, look in the project directory (and, for .sdkmanrc / .tool-versions / .java-version, the same directory as the manifest) for those pin files. Extract a numeric major (and minor, if present) from:

  • .java-version: first non-comment token; allow 17 or openjdk64-17.0.10
  • .sdkmanrc: the java= value; use the leading digits.digits / major (strip a vendor suffix such as -tem, -amzn)
  • .tool-versions: the java line; take the first token that contains a digit run (temurin-17.0.10 → 17.0.10 or 17)

Precedence: build-file version (POM properties / Gradle toolchain) > .java-version > .sdkmanrc > .tool-versions. Skip system and unparsable values. A missing file never fails the scan.

Acceptance
  • Add tests next to test/gradle-java-version.test.ts / test/gradle-kotlin-jvmtoolchain.test.ts.
  • Each pin file alone reports a Java 17 runtime when the build file has no version.
  • A Gradle jvmToolchain(21) or a POM maven.compiler.release still wins over the pin files.
  • Precedence between the three pin files matches the list above.
  • Unparsable or system values yield no runtime from that file.

Ngôn ngữ chính
TypeScript
Star
4
Fork
3
Merge trung bình
1 ngày 22 giờ
Pull request đã merge (30 ngày)
76

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của vibgrate/cli

Tất cả issue của vibgrate/cli

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.