【发布时间】:2018-05-01 07:24:05
【问题描述】:
我使用 GitHub 的 Immutables 库进行 Android 开发,现在我也想在后端尝试一下。
在 Android 中,为了使用该库,我只需要这样做:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
// immutable entities generation
provided "org.immutables:value:2.5.5" // for annotations
provided "org.immutables:builder:2.5.5" // for annotations
provided "org.immutables:gson:2.5.5" // for annotations
... other dependencies
}
当我尝试将上述依赖项复制到我的 Java 项目的 build.gradle 中时,我收到此错误:
Error:(24, 0) Gradle DSL method not found: 'provided()'
我尝试将provided替换为compileOnly和compile,但是没有生成带有@Value.Immutable注释的接口的实现。
如何让它发挥作用?
【问题讨论】:
标签: java intellij-idea gradle build.gradle immutables-library