You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Compatibility with JDK 9 Jigsaw Builds [SPR-12549] #17151
As expected, the core framework does build and run on JDK 9. However, the usual suspects in the wider build - the spring-aspects module and the spring-oxm module - break since their build setup relies on custom compilers, none of which have been made compatible with JDK 9 yet.
To be revisited for Spring Framework 4.2 - however, we may be stuck on a JDK 8 build for some time to come. AspectJ 1.9 is unlikely to happen before 2016, and Castor / JiBX / XMLBeans might not get updated any time soon. That said, at this point, there is no need for us to build on JDK 9 either.
An update against JDK 9 build 52: spring-oxm builds and its tests pass now. However, spring-aspects still doesn't compile due to AspectJ 1.8.5 not being able to find the standard JDK class library on a JDK 9 installation.
Andy Clement, any chance for AspectJ 1.8.x. to 'tolerate' JDK 9 in such a scenario? There is no need for -target 1.9 yet and probably won't be for years to come; all we'd need is the ability to build and run the entire test suite on JDK 9.
Hey Juergen, it has been vaguely on my radar to look at but I have not yet had a forcing function to do the work. I see I have that now :) I'll take a look when I get a minute.
Hmmm. If it were just the weaver that needed smarts for understanding Java9 that would be one thing but it is also the JDT compiler that we depend upon - that complicates things. I'll reach out to the eclipse guys to see if anyone has already started anything on this.
Since we don't need support for the 1.9 language level, maybe there's a way to patch the JDT compiler to just find the class libraries? Assuming there are no other incompatibilities, of course...
If it turns out to be too much hassle, we can defer this until early 2016 as well. It would just be nice to run a CI build against JDK 9 from this summer onwards, once JDK 9 enters its API freeze.
maybe there's a way to patch the JDT compiler to just find the class libraries?
It is a bit messy due to all the layers of abstraction in JDT. However, I found that they have a BETA_JAVA9 branch of JDT with some preliminary work in it. I grabbed that, found it was a little incomplete and added a bit more code - this got compilation working but the weaver didn't work so I did some extra hacks to get the weaver limping along too. The upshot is that there does exist an AspectJ 1.9.0.BETA-1. This has been published to repo.spring.io but that repo seems to be going slow from a refresh point of view so my gradle build isn't finding it there (I can't see it in the artifactory browser even though I know it is there) so if you use this repository (which is what repo.spring.io is the facade for):
Andy, you're the man: The Spring Framework master build and tests pass fine with Aspectj 1.9.0.BETA-1. Thanks for that amazingly quick turnaround!
I'm trying to conditionally add it to 4.2, with our build dynamically switching to Aspectj 1.9.0.BETA-1 when executing on JDK 9... or simply always using it, even on JDK 8, but just for our use of ajc and not for the runtime libs as published in our POMs. The latter would be similar to how we dealt with AspectJ 1.8 vs 1.7 at the time when JDK 8 wasn't GA yet.
In yesterday's efforts, I accidentally ran the spring-oxm tests after previously executing them on JDK 8... That's what made them pass, since with the generated artifacts not present (i.e. a clean build), the compileTestJava phase fails on JDK 9 build 52, like previously.
Nevertheless, with AspectJ 1.9.0.BETA-1 used for the ajc task, a few spring-core tests fine-tuned and spring-oxm tests selectively deactivated, everything passes fine on JDK 9 with a clean build now. To be pushed once the AspectJ beta shows up at repo.spring.io.
Juergen Hoeller, have you been executing gradlew clean test against JDK 9?
I ask, because I just installed the following on my Mac:
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build 1.9.0-ea-b53)
Java HotSpot(TM) 64-Bit Server VM (build 1.9.0-ea-b53, mixed mode)
And when I execute gradlew clean test, I get the following compiler error:
:spring-core:compileJava
/Users/XXX/source/spring-framework/spring-core/src/main/java/org/springframework/util/CollectionUtils.java:356: error: incompatible types: List<CAP#1> cannot be converted to List<V>
List<V> values = Collections.unmodifiableList(entry.getValue());
^
where V,K are type-variables:
V extends Object declared in method <K,V>unmodifiableMultiValueMap(MultiValueMap<? extends K,? extends V>)
K extends Object declared in method <K,V>unmodifiableMultiValueMap(MultiValueMap<? extends K,? extends V>)
where CAP#1 is a fresh type-variable:
CAP#1 extends V from capture of ? extends V
1 error
:spring-core:compileJava FAILED
Made further changes to Gradle build to support JDK 9 in GitHub commit 7bc44a9:
Set Gradle Daemon JVM args compatible with JDK 9
This commit adds the following to gradle.properties in order to execute
the Gradle daemon on JDK 9, since Gradle's DaemonParameters
automatically sets the MaxPermSize JVM argument, which is no longer
supported on JDK 9.
Hmm. a clean test run does pass for me against JDK 9 build 52... including spring-core. Maybe it's a regression in JDK 9 build 53?
BTW, after those Gradle JVM settings changed, the Gradle wrapper seems to fork a new JVM for every run now. Can we avoid that somehow, even with the new settings in place?
Andy Clement, I can still only grab AspectJ 1.9.0.BETA-1 from the Amazon URL, not from anywhere at repo.spring.io. It does show up at http://repo.spring.io/snapshot/org/aspectj/aspectjtools/ but I can't seem to grab it from there... And shouldn't it be in the /milestone category instead of /snapshot?
You are right Juergen, it probably should be in /milestone, i was just in a hurry. I republished it this morning into there and I can immediately consume it from repo.spring.io/milestone. Wonder if that snapshot area doesn't like a non standard naming scheme (it obviously wasn't called BUILD-SNAPSHOT).
It does, but it's not the --daemon that I mind. I just wonder why it's not reusing the bootstrap JVM anymore if there is no daemon. I suppose we have a difference in JVM settings that makes it fork a different JVM now? Can we apply them to the bootstrap JVM as well, allowing it to be reused again? That would be preferable to enforcing the daemon IMO.
Sam Brannen, neither of the two. However, in our gradlew.bat in the repo, there is a set GRADLE_OPTS entry which I assume will be picked up here: Changing that entry to -XX:MaxMetaspaceSize=1024m -Xmx1024m, like we have it in gradle.properties now, doesn't seem to help though. Maybe Gradle simply forks a new JVM based on the plain presence of a org.gradle.jvmargs entry...
Andy Clement, cool, works for me as well now! I'm going to commit our revised Gradle build against repo.spring.io/milestone in a few min, using AspectJ 1.9.0.BETA-1 for ajc then but preserving AspectJ 1.8.5 for our runtime declarations (which is the only part exposed in our POMs). Together with a few other tweaks, that allows our build to run on either JDK 8 or 9!
However, in our gradlew.bat in the repo, there is a set GRADLE_OPTS entry which I assume will be picked up here: Changing that entry to -XX:MaxMetaspaceSize=1024m -Xmx1024m, like we have it in gradle.properties now, doesn't seem to help though.
Yes, that should be picked up if you're executing gradlew.bat on Windows.
Note, however, that those JVM settings are overwritten whenever you execute gradlew wrapper since we configure this in build.gradle (search for gradleBatOpts). So make sure you update gradleBatOpts if you make any changes.
Maybe Gradle simply forks a new JVM based on the plain presence of a org.gradle.jvmargs entry...
Many settings (like the Java version and maximum heap size) can only be specified when launching a new JVM for the build process. This means that Gradle must launch a separate JVM process to execute the build after parsing the various gradle.properties files. When running with the daemon, a JVM with the correct parameters is started once and reused for each daemon build execution. When Gradle is executed without the daemon, then a new JVM must be launched for every build execution, unless the JVM launched by the Gradle start script happens to have the same parameters.
This launching of an extra JVM on every build execution is quite expensive, which is why if you are setting either org.gradle.java.home or org.gradle.jvmargs we highly recommend that you use the Gradle Daemon. See Chapter 19, The Gradle Daemon for more details.
The explanation in the last paragraph is why I recommended adding org.gradle.daemon=true to gradle.properties since we are now setting org.gradle.jvmargs.
Update: I have reverted the troublesome changes as described in GitHub commit b1fdb4a:
Remove Gradle Daemon JVM args compatible with JDK 9
This commit reverts the changes made in 7bc44a9 so that developers who
do not use the Gradle daemon are not adversely affected by the explicit
JVM args that were introduced in that commit.
Developers who wish to run the build against JDK 9 with the Gradle
daemon can add the following to the gradle.properties file in their
'gradle user home' directory (e.g., ~/.gradle/gradle.properties):
Activity
spring-projects-issues commentedon Dec 22, 2014
Juergen Hoeller commented
As expected, the core framework does build and run on JDK 9. However, the usual suspects in the wider build - the
spring-aspectsmodule and thespring-oxmmodule - break since their build setup relies on custom compilers, none of which have been made compatible with JDK 9 yet.To be revisited for Spring Framework 4.2 - however, we may be stuck on a JDK 8 build for some time to come. AspectJ 1.9 is unlikely to happen before 2016, and Castor / JiBX / XMLBeans might not get updated any time soon. That said, at this point, there is no need for us to build on JDK 9 either.
spring-projects-issues commentedon Mar 3, 2015
Juergen Hoeller commented
An update against JDK 9 build 52:
spring-oxmbuilds and its tests pass now. However,spring-aspectsstill doesn't compile due to AspectJ 1.8.5 not being able to find the standard JDK class library on a JDK 9 installation.Andy Clement, any chance for AspectJ 1.8.x. to 'tolerate' JDK 9 in such a scenario? There is no need for
-target 1.9yet and probably won't be for years to come; all we'd need is the ability to build and run the entire test suite on JDK 9.Juergen
spring-projects-issues commentedon Mar 3, 2015
Andy Clement commented
Hey Juergen, it has been vaguely on my radar to look at but I have not yet had a forcing function to do the work. I see I have that now :) I'll take a look when I get a minute.
spring-projects-issues commentedon Mar 3, 2015
Andy Clement commented
Hmmm. If it were just the weaver that needed smarts for understanding Java9 that would be one thing but it is also the JDT compiler that we depend upon - that complicates things. I'll reach out to the eclipse guys to see if anyone has already started anything on this.
spring-projects-issues commentedon Mar 3, 2015
Juergen Hoeller commented
Since we don't need support for the 1.9 language level, maybe there's a way to patch the JDT compiler to just find the class libraries? Assuming there are no other incompatibilities, of course...
If it turns out to be too much hassle, we can defer this until early 2016 as well. It would just be nice to run a CI build against JDK 9 from this summer onwards, once JDK 9 enters its API freeze.
spring-projects-issues commentedon Mar 4, 2015
Andy Clement commented
It is a bit messy due to all the layers of abstraction in JDT. However, I found that they have a BETA_JAVA9 branch of JDT with some preliminary work in it. I grabbed that, found it was a little incomplete and added a bit more code - this got compilation working but the weaver didn't work so I did some extra hacks to get the weaver limping along too. The upshot is that there does exist an AspectJ 1.9.0.BETA-1. This has been published to repo.spring.io but that repo seems to be going slow from a refresh point of view so my gradle build isn't finding it there (I can't see it in the artifactory browser even though I know it is there) so if you use this repository (which is what repo.spring.io is the facade for):
maven { url "http://s3.amazonaws.com/maven.springframework.org/snapshot" }
and this version
1.9.0.BETA-1
you might get a bit further. Let me know how it goes.
spring-projects-issues commentedon Mar 5, 2015
Juergen Hoeller commented
Andy, you're the man: The Spring Framework master build and tests pass fine with Aspectj 1.9.0.BETA-1. Thanks for that amazingly quick turnaround!
I'm trying to conditionally add it to 4.2, with our build dynamically switching to Aspectj 1.9.0.BETA-1 when executing on JDK 9... or simply always using it, even on JDK 8, but just for our use of ajc and not for the runtime libs as published in our POMs. The latter would be similar to how we dealt with AspectJ 1.8 vs 1.7 at the time when JDK 8 wasn't GA yet.
Juergen
spring-projects-issues commentedon Mar 5, 2015
Juergen Hoeller commented
In yesterday's efforts, I accidentally ran the
spring-oxmtests after previously executing them on JDK 8... That's what made them pass, since with the generated artifacts not present (i.e. a clean build), thecompileTestJavaphase fails on JDK 9 build 52, like previously.Nevertheless, with AspectJ 1.9.0.BETA-1 used for the ajc task, a few
spring-coretests fine-tuned andspring-oxmtests selectively deactivated, everything passes fine on JDK 9 with a clean build now. To be pushed once the AspectJ beta shows up atrepo.spring.io.Juergen
spring-projects-issues commentedon Mar 5, 2015
Sam Brannen commented
Juergen Hoeller, have you been executing
gradlew clean testagainst JDK 9?I ask, because I just installed the following on my Mac:
And when I execute
gradlew clean test, I get the following compiler error:spring-projects-issues commentedon Mar 5, 2015
Sam Brannen commented
Made further changes to Gradle build to support JDK 9 in GitHub commit 7bc44a9:
spring-projects-issues commentedon Mar 5, 2015
Sam Brannen commented
See also the "DaemonParameters does not support JDK 9 by default" bug in the Gradle Forum.
spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Hmm. a
clean testrun does pass for me against JDK 9 build 52... includingspring-core. Maybe it's a regression in JDK 9 build 53?BTW, after those Gradle JVM settings changed, the Gradle wrapper seems to fork a new JVM for every run now. Can we avoid that somehow, even with the new settings in place?
Juergen
spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Andy Clement, I can still only grab AspectJ 1.9.0.BETA-1 from the Amazon URL, not from anywhere at
repo.spring.io. It does show up athttp://repo.spring.io/snapshot/org/aspectj/aspectjtools/but I can't seem to grab it from there... And shouldn't it be in the/milestonecategory instead of/snapshot?Juergen
spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Sam Brannen, it's indeed a regression with Java 9 build 53! Fails for me on that very same spot as well now...
So much for tracking a moving target, even within the same week :-)
Juergen
spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Collections.unmodifiableMultiValueMapexplicitly casts fromList<? extends V>toList<V>now, which apparently is necessary as of Java 9 build 53.7 remaining items
spring-projects-issues commentedon Mar 6, 2015
Andy Clement commented
You are right Juergen, it probably should be in /milestone, i was just in a hurry. I republished it this morning into there and I can immediately consume it from repo.spring.io/milestone. Wonder if that snapshot area doesn't like a non standard naming scheme (it obviously wasn't called BUILD-SNAPSHOT).
spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
It does, but it's not the
--daemonthat I mind. I just wonder why it's not reusing the bootstrap JVM anymore if there is no daemon. I suppose we have a difference in JVM settings that makes it fork a different JVM now? Can we apply them to the bootstrap JVM as well, allowing it to be reused again? That would be preferable to enforcing the daemon IMO.spring-projects-issues commentedon Mar 6, 2015
Sam Brannen commented
Juergen Hoeller, do you by any chance have
GRADLE_OPTSorJAVA_OPTSset as environment variables, and if so what are the values?spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Sam Brannen, neither of the two. However, in our
gradlew.batin the repo, there is aset GRADLE_OPTSentry which I assume will be picked up here: Changing that entry to-XX:MaxMetaspaceSize=1024m -Xmx1024m, like we have it ingradle.propertiesnow, doesn't seem to help though. Maybe Gradle simply forks a new JVM based on the plain presence of aorg.gradle.jvmargsentry...spring-projects-issues commentedon Mar 6, 2015
Juergen Hoeller commented
Andy Clement, cool, works for me as well now! I'm going to commit our revised Gradle build against
repo.spring.io/milestonein a few min, using AspectJ 1.9.0.BETA-1 for ajc then but preserving AspectJ 1.8.5 for our runtime declarations (which is the only part exposed in our POMs). Together with a few other tweaks, that allows our build to run on either JDK 8 or 9!spring-projects-issues commentedon Mar 6, 2015
Stéphane Nicoll commented
Sam Brannen for the record I am affected by this as well.
spring-projects-issues commentedon Mar 6, 2015
Sam Brannen commented
Stéphane Nicoll,
What OS are you using?
And how are you invoking Gradle?
spring-projects-issues commentedon Mar 6, 2015
Sam Brannen commented
Juergen Hoeller,
Yes, that should be picked up if you're executing
gradlew.baton Windows.Note, however, that those JVM settings are overwritten whenever you execute
gradlew wrappersince we configure this inbuild.gradle(search forgradleBatOpts). So make sure you updategradleBatOptsif you make any changes.The "20.1.1. Forked Java processes" section of the Gradle reference manual states the following:
The explanation in the last paragraph is why I recommended adding
org.gradle.daemon=truetogradle.propertiessince we are now settingorg.gradle.jvmargs.Thoughts?
spring-projects-issues commentedon Mar 6, 2015
Stéphane Nicoll commented
Sam, OSX and I am using the gradle wrapper.
spring-projects-issues commentedon Mar 7, 2015
Sam Brannen commented
Update: I have reverted the troublesome changes as described in GitHub commit b1fdb4a:
spring-projects-issues commentedon Mar 7, 2015
Sam Brannen commented
I also updated the wiki:
https://github.com/spring-projects/spring-framework/wiki/Gradle-build-and-release-FAQ#user-content-wiki-gradle_daemon