Make it possible to actually use (e.g.) -Dsurefire.toolchain.version=21
to set the Java version for tests, and do so in CI. (The property value still _defaults_ to the JDK that you use to run Maven, so passing the flag is not _necessary_.)
#7589
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Make it possible to actually use (e.g.)
-Dsurefire.toolchain.version=21
to set the Java version for tests, and do so in CI. (The property value still defaults to the JDK that you use to run Maven, so passing the flag is not necessary.)This lets us use whatever Java version we want[1] for executing Maven itself—and thus for executing any plugins that aren't toolchain-aware. (I even hacked up our toolchain configuration to run tests under Java 24, and it worked.) I've changed our CI to do that, too, by always using Java 23. (This makes the explicit choice of Java 23 for javac redundant under CI, as well as on our Google workstations. However, it can be useful for anyone who builds Guava locally while having an older JDK as the default version.)
Notably, that means that we can use a new version (like Java 23) for running the GWT plugin, which lets us upgrade to GWT 2.12.1 (cl/711417161), which uses an Eclipse compiler with bytecode version 55 (Java 11)[2]. (This means that users who build
guava-gwt
locally with Java 8 will need to upgrade their build JDK to at least Java 11—or skip buildingguava-gwt
if they don't need it.)That GWT upgrade is in turn necessary in order for us to be able to use use JSpecify annotations from our GWT artifact.
In theory, this could also prepare us for further changes, like more easily running tests under multiple versions during our release process (in addition to how we already do so for CI), though there are already other ways of doing that by hacking up our release script or
pom.xml
. And I'm not sure that I'd really want to do that, anyway. (See also some notes that I've added to cl/639128020.)I also did some related cleanup:
--no-module-directories
configuration probably became Just Wrong back in cl/655647768: It should be based on the version that we use to build Javadoc (which is currently always 11), not the version that Maven is running under. It probably mostly doesn't matter because we probably mostly don't try to run Javadoc under other versions, but I'd like to be able to do so, so this is a step forward.-Djava.security.manager=allow
is not necessary now that we've cleaned up our usages ofSecurityManager
. (And that's fortunate, as it seems difficult to active a profile based on a range of values of an arbitrary "my test JRE version" property, as opposed to activate it based on the JDK that Maven is running under.)Fixes #7492 (by making
setup-java
download all the toolchains that we need)[1] I mean, I suspect that Maven support lags new JDKs somewhat, and I've seen problems with other versions (as documented in cl/488902996). But at least we don't have to use the same Java version for executing Maven itself as we do for executing tests.
[2] That was causing this error:
RELNOTES=n/a