setup-java/__tests__
Nikolas Grottendieck 77ee41d00e
fix: Maven Toolchains grows unexpectedly (#534)
* fix: Maven Toolchains grows unexpectedly

On self-hosted runners toolchains.xml may survive multiple runs and unexpectedly
grow as a result of the toolchains setup simply appending the JDK definition
even if one with the same `type` and `provides.id` already exists.

Restructuring the parsing step and filtering the potentially existing list of
toolchain definitions prevents this and also fixes toolchain.xml files that
already contain duplicates.

Fixes #530

* fix: guard toolchain dedup and preserve existing root attributes

Address reviewer feedback on the Maven toolchains dedup logic:

- Treat jdk toolchains without a string `provides.id` as non-deduplicatable
  and use optional access when comparing ids, so partially-formed or
  nonstandard toolchains.xml files no longer crash setup.
- Preserve the existing `<toolchains>` root attributes (xmlns,
  schemaLocation, …) when present, falling back to the 1.1.0 defaults only
  for attributes the existing file is missing. This avoids silently
  rewriting user-managed metadata or changing the effective namespace.

Adds tests covering custom root attributes and id-less jdk toolchains, and
rebuilds dist/.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Bruno Borges <brborges@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2026-07-07 00:01:31 -04:00
..
cache feat: implement cache-dependency-path option to control caching dependency (#499) 2023-11-22 16:43:14 +01:00
data feat: Add verify-signature plumbing and Temurin+Microsoft verification support (#1060) 2026-06-29 13:19:49 +01:00
distributors Updated jetbrains test: https.request() now catches errors. This fixes leaking tests as well (#1070) 2026-07-02 15:01:00 -04:00
auth.test.ts feat: Disable interactiveMode in generated Maven settings.xml (#1052) 2026-07-02 17:22:38 -04:00
cache.test.ts Add Maven Wrapper cache feature (#1027) 2026-06-22 09:45:18 -05:00
cleanup-java.test.ts Spelling (#713) 2026-06-22 10:57:54 -04:00
gpg.test.ts feat: Add verify-signature plumbing and Temurin+Microsoft verification support (#1060) 2026-06-29 13:19:49 +01:00
maven-args.test.ts feat: suppress Maven transfer progress via MAVEN_ARGS by default (add show-download-progress input) (#1053) 2026-07-02 17:12:50 -04:00
toolchains.test.ts fix: Maven Toolchains grows unexpectedly (#534) 2026-07-07 00:01:31 -04:00
util.test.ts fix: reject non-semver candidate versions in isVersionSatisfies (#1009) 2026-06-17 22:47:02 -05:00
verify-java.sh Revert "Revert "Add support for Oracle JDK (#401)" (#421)" (#450) 2023-02-07 16:29:21 +01:00