[英]gradle 4.10 + java11 = dependency version detection problem with spring(and many other libraries)
I'm working under project conversion from java 8 to 11 + gradle 4.5 -> 4.10.3 and found very strange thing for me. 我正在从java 8到11 + gradle 4.5 - > 4.10.3的项目转换下工作,发现对我来说非常奇怪。 gradle take wrong jar versions .
gradle采取错误的jar版本。 for example part of
例如。的一部分
gradle dependencies
gradle依赖
\--- 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 !!! spring-security-web:5.1.3.RELEASE - > 4.2.2.RELEASE !!!
tomcat-embed-core:9.0.14 -> 8.5.11!!! tomcat-embed-core:9.0.14 - > 8.5.11 !!!
tomcat-embed-el: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!!! 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 ? 它意味着gradle使用版本X进行编译,将版本Y用于运行时,为什么编译没有失败? method exists only in version 9. compilation must fail on it, no?
方法只存在于版本9中。编译必须失败,不是吗? 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.
看起来我也需要在我的gradle中指定3d party依赖项的版本,例如:A取决于B,B取决于C,我需要写A:A取决于B而A取决于C.我测试了它这项工作,但它看起来非常非常错误的方式。 any ideas how to resolve dependencies without such version hops.
任何想法如何解决没有这种版本跳跃的依赖关系。
This Gradle version does not seem to support Java 11. See Issue 7835 此Gradle版本似乎不支持Java 11.请参阅问题7835
You will have to upgrade to Gradle 5.0 to use Java 11, see release notes . 您必须升级到Gradle 5.0才能使用Java 11,请参阅发行说明 。
There are some mentions that Gradle itself will run with Java 11 but not for builds themselves. 有人提到Gradle本身将使用Java 11运行,但不会自行运行。 It looks a bit confusing but the release notes a quite clear that Java 11 support comes only with Gradle 5.0+
它看起来有点令人困惑,但该发行版清楚地表明Java 11支持仅来自Gradle 5.0+
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.