Gradle自定义插件:gradleApi()vs显式依赖 [英] Gradle Custom Plugin: gradleApi() vs Explicit Dependency

查看:959
本文介绍了Gradle自定义插件:gradleApi()vs显式依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发自定义gradle插件,并且我的插件项目的依赖项如下所示:

I'm developing a custom gradle plugin and the dependencies for my plugin project look like this:

dependencies {
  compile gradleApi()
  compile localGroovy()
  compile('com.xxx.oozie:oozie-dsl-parser:1.0.127') {
    exclude module: 'groovy-all'
  }

  testCompile('org.spockframework:spock-core:1.0-groovy-2.3') {
    exclude module: 'groovy-all'
  }
}

但是,出于可复制性的考虑,我想知道是否建议使用localGroovy()gradleApi().

However, in the interest of reproducible builds, I'm wondering if using localGroovy() and gradleApi() is advisable.

经过大量的搜索,尽管我可以用特定版本的groovy替换localGroovy(),但是我似乎找不到关于将gradleApi()替换为什么的明确答案.

After much googling, although I could replace localGroovy() with a specific version of groovy, I can't seem to find a definitive answer on what I would replace gradleApi() with.

你们有什么建议吗?

谢谢!

推荐答案

查看 https://github.com/gradle/gradle/issues/1835 似乎没有明确的依赖关系可用于该目的.

Looking at https://github.com/gradle/gradle/issues/1835 it seems like there is no explicit dependency you can use for that purpose.

尽管不等同于gradleApi(),但如果您是为Android开发的,则可能会对com.android.tools.build:gradle-api:3.3.2依赖项感兴趣.

Although not equivalent to gradleApi(), if you are developing for Android you might be interested in the com.android.tools.build:gradle-api:3.3.2 dependency.

这篇关于Gradle自定义插件:gradleApi()vs显式依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆