简体   繁体   English

如何从 gradle 6 更改内部 groovy 版本?

[英]How can I change the internal groovy version from gradle 6?

In the screenshot are marked the two groovy versions I need to change Im working on a grails 4 project trying to integrate it with open clover plugin for testing coverage.在屏幕截图中标记了两个 groovy 版本,我需要更改我正在处理 grails 4 项目,试图将其与开放式三叶草插件集成以测试覆盖率。 Im trying to use the groovy version I have installed and set as default in my local, instead of using the internal version that ships with gradle.我尝试使用我在本地安装并设置为默认值的 groovy 版本,而不是使用 gradle 附带的内部版本。 How can I do that?我怎样才能做到这一点?

You can't replace or remove the shipped/provided Groovy that comes with Gradle because:您无法更换或移除 Gradle 随附的随附/提供的 Groovy,因为:

  • Gradle's build language is based on Groovy Gradle 的构建语言基于 Groovy
  • Parts of Gradle are implemented in Groovy Gradle 的部分实现在 Groovy

So Gradle is effectively tied to whatever version of Groovy it was shipped with for that release.因此,Gradle 有效地与该版本随附的 Groovy 的任何版本相关联。 If your project requires a different version or requires Groovy in general, then you need to explicitly declare a Groovy dependency as you would for any Groovy project:如果您的项目需要不同的版本或通常需要 Groovy,那么您需要像对任何 Groovy 项目一样显式声明 Groovy 依赖项:

dependencies {
    implementation "org.codehaus.groovy:groovy-all:3.0.4"
}

Warning: my answer is hard and not adviced.警告:我的回答很难,不建议。

If really you want to change the version of groovy in gradle, you might clone gradle from source, edit subproject/language-java/build.gradle.kts for java compiler, and same in any subprojects. If really you want to change the version of groovy in gradle, you might clone gradle from source, edit subproject/language-java/build.gradle.kts for java compiler, and same in any subprojects.

I do not recommend you to do that.我不建议你这样做。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM