Gradle MultiProject定义对根项目的依赖 [英] Gradle multiproject define dependency on root project
本文介绍了Gradle MultiProject定义对根项目的依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个以这种方式配置的多项目gradle构建:
I have a multi project gradle build, configured in this way:
root
|
|---- projectA
|
|---- projectB
我想在root/build.gradle
中声明所有嵌套项目的依赖关系,这是文件:
I want to declare in the root/build.gradle
a dependency for all nested projects, this is the file:
subprojects {
version = '1.0-SNAPSHOT'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://repository.jboss.org/nexus/content/groups/public-jboss/'
}
}
}
allprojects {
dependencies {
compile 'org.projectlombok:lombok:1.12.2'
}
}
但是当我执行构建时,我有:
But when I execute the build, I have:
* What went wrong:
评估根项目代码"时发生问题.
A problem occurred evaluating root project 'code'.
No signature of method:
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [org.projectlombok:lombok:1.12.2]
可能的解决方案:模块(java.lang.Object)
Possible solutions: module(java.lang.Object)
我做错了什么?
推荐答案
compile
method is part of the plugin you've been using (reference).
allprojects {
apply plugin: 'java'
//so that we can use 'compile', 'testCompile' for dependencies
dependencies {
compile 'org.projectlombok:lombok:1.12.2'
}
}
这篇关于Gradle MultiProject定义对根项目的依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文