gnodet opened a new issue, #13857:
URL: https://github.com/apache/maven/issues/13857
## Problem
`AbstractMavenIntegrationTestCase.newVerifier()` unconditionally sets:
```java
verifier.getSystemProperties().put("maven.compiler.source", "8");
verifier.getSystemProperties().put("maven.compiler.target", "8");
verifier.getSystemProperties().put("maven.compiler.release", "8");
```
This was reasonable when Maven supported JDK 8 runtimes, but Maven 4 itself
requires JDK 17 (`javaVersion=17` in the root POM) and so do all Maven 4
plugins. Setting `release=8` as the global default means:
- Tests that build Maven 4 plugins must override this per-verifier
(boilerplate, easy to forget).
- Generated code (e.g. the `HelpMojo` emitted by `maven-plugin-mixin`'s
annotation processor) must avoid Java 11+ / Java 16+ APIs even though the
plugin will never run on JDK 8.
- New ITs for Maven 4 features that use modern Java (records, sealed types,
text blocks, `Stream.toList()`, etc.) need per-verifier overrides — see
[#13644](https://github.com/apache/maven/pull/13658) for a recent example, and
[gh-11378](https://github.com/apache/maven/pull/13658) for another.
## Proposal
Raise the default in `AbstractMavenIntegrationTestCase` to **17**:
```java
// Maven 4 requires JDK 17; use 17 as the baseline for IT-compiled projects
verifier.getSystemProperties().put("maven.compiler.release", "17");
verifier.getSystemProperties().remove("maven.compiler.source");
verifier.getSystemProperties().remove("maven.compiler.target");
```
(Drop `source`/`target` entirely — `release` supersedes them and prevents
the well-known cross-compilation footgun of mismatched source/target vs
bootstrap classpath.)
## Considerations
- **ITs that explicitly test JDK 8 bytecode level** (e.g. `mng-6118`,
`mng-6981`, `mng-3503`, etc.) already set their own
`<maven.compiler.source>`/`<maven.compiler.target>` in their test-resource
`pom.xml` — those would override the global default and continue to work.
- The 157 occurrences of `maven.compiler.{release,source,target}` in test
resources fall into two buckets:
- Explicit `1.8`/`8` overrides in individual test POMs → still honoured,
no change.
- Properties inherited from the global default → will now compile to Java
17 bytecode, which is correct for Maven 4.
- The CI matrix already runs all ITs on JDK 17, 25, and 27 — none of which
can produce JDK 8 bytecode with `release=17`.
## Impact
Low risk: the change only affects tests that relied on the implicit
`release=8` default and have no explicit override. Those tests compile
trivially simple plugin stubs; the bytecode level has never mattered for them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]