问题描述
我的项目给我一个非法反射"警告,这在Groovy v3.0之前似乎是一个问题.但是,我机器上的Gradle正在运行Groovy v2.5.4,我似乎无法将其提高到> 3.0.我已经尝试在依赖项中使用"compile 'org.codehaus.groovy:groovy-all:3.0.2'
",但这无济于事.
My project is giving me an "Illegal Reflective" warning, which seems to be a problem before Groovy v3.0. However, Gradle on my machine is running Groovy v2.5.4 and I can't seem to bump this to > 3.0. I've tried having "compile 'org.codehaus.groovy:groovy-all:3.0.2'
" in my dependencies but this doesn't do anything.
如何提高Gradle使用的Groovy版本?
How can I bump the version of Groovy that Gradle uses?
推荐答案
Gradle具有内部Groovy,可用于运行Gradle本身.声明对Groovy的编译依赖性不会改变这一点.要更改内部Groovy版本,我知道的唯一方法是转到已安装的Gradle的lib目录,并替换其中的groovy jar.
Gradle has an internal Groovy it uses to run Gradle itself. Declaring a compile dependency on Groovy will not change that. To change the internal Groovy version the only way I know is to go to the lib directory of your installed Gradle and replace the groovy jars in there.
但是我建议不要这样做.您可能会看到副作用. Groovy 3包含重大更改,我不知道它们是否会影响Gradle.其中一些对Grails产生了影响,这就是为什么尽管3.0相当新,我们仍然拥有3.0.2的原因.
But I advise against doing that. You may see side effects. Groovy 3 contains breaking changes and I do not know if they impact Gradle. Some of them impacted Grails, which is why we already have 3.0.2 despite 3.0 being quite new.
非法反射"警告仅是警告.只是在这种情况下,才试图迫使图书馆制造者停止做他们宣称的错误(Java API的制造者),并警告他们将在某个时候强制执行.但是,JDK11尚不重要.
The "Illegal Reflective" warning is just that, a warning. It is only there to try to force library makers to quit doing what they (the makers of the Java API) declared as wrong and warn they will enforce it at some point. But JDK11 is not yet that point.
这篇关于在Gradle中颠簸Groovy版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!