Reputation: 2326
I'm working under project conversion from java 8 to 11 + gradle 4.5 -> 4.10.3 and found very strange thing for me. gradle take wrong jar versions . for example part of
gradle dependencies
\--- org.springframework.security:spring-security-web:5.1.3.RELEASE -> 4.2.2.RELEASE
Line 407: | +--- org.springframework:spring-beans:4.3.5.RELEASE -> 5.1.4.RELEASE (*)
Line 408: | +--- org.springframework:spring-context:4.3.5.RELEASE -> 5.1.4.RELEASE (*)
Line 409: | +--- org.springframework:spring-core:4.3.5.RELEASE -> 5.1.4.RELEASE (*)
Line 410: | +--- org.springframework:spring-expression:4.3.5.RELEASE -> 5.1.4.RELEASE (*)
Line 411: | \--- org.springframework:spring-web:4.3.5.RELEASE -> 5.1.4.RELEASE (*)
Line 419: | | | +--- com.fasterxml.jackson.core:jackson-databind:2.9.8 -> 2.8.7 (*)
Line 420: | | | +--- com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.9.8 -> 2.8.7
Line 423: | | | +--- com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.9.8 -> 2.8.7
Line 427: | | | \--- com.fasterxml.jackson.module:jackson-module-parameter-names:2.9.8 -> 2.8.7
Line 432: | | | +--- org.apache.tomcat.embed:tomcat-embed-core:9.0.14 -> 8.5.11
Line 433: | | | +--- org.apache.tomcat.embed:tomcat-embed-el:9.0.14 -> 8.5.11
Line 434: | | | \--- org.apache.tomcat.embed:tomcat-embed-websocket:9.0.14 -> 8.5.11
Line 437: | | | +--- javax.validation:validation-api:2.0.1.Final -> 1.1.0.Final
Line 438: | | | +--- org.jboss.logging:jboss-logging:3.3.2.Final -> 3.3.0.Final
spring-security-web:5.1.3.RELEASE -> 4.2.2.RELEASE !!!
tomcat-embed-core:9.0.14 -> 8.5.11!!!
tomcat-embed-el:9.0.14 -> 8.5.11!!!
org.apache.tomcat.embed:tomcat-embed-websocket:9.0.14 -> 8.5.11!!!
and application failed in runtime:
An attempt was made to call the method org.apache.coyote.AbstractProtocol.setAcceptCount(I)V but it does not exist. Its class, org.apache.coyote.AbstractProtocol, is available from the following locations:
jar:file:/C:/yyyyyyyyyyyyyy/bin/java/TxVersionServer/lib/tomcat-embed-core-8.5.11.jar!/org/apache/coyote/AbstractProtocol.class
It was loaded from the following location:
file:/C:/Program%20Files/Dalet/DaletPlus/bin/java/TxVersionServer/lib/tomcat-embed-core-8.5.11.jar
it mean gradle use version X for compilation and version Y for runtime, why compilation was not failed ? method exists only in version 9. compilation must fail on it, no? how I can avoid it? looks like I need specify version of 3d party dependencies in my gradle too, for example: A depends on B , B depends on C, and I need to write in A: A depends on B and A depends on C. I tested it and this work, but it's look very and very wrong way. any ideas how to resolve dependencies without such version hops.
Upvotes: 1
Views: 1512
Reputation: 8160
This Gradle version does not seem to support Java 11. See Issue 7835
You will have to upgrade to Gradle 5.0 to use Java 11, see release notes.
There are some mentions that Gradle itself will run with Java 11 but not for builds themselves. It looks a bit confusing but the release notes a quite clear that Java 11 support comes only with Gradle 5.0+
Upvotes: 1