找不到多模块项目的方法compile() [英] Could not find method compile() for a multi module project
问题描述
dependencies {
compile project('client')
compile project('-cache
')
现在,当我注释掉 compile project('product-cache-client')
时,它
Now when I comment out compile project('product-cache-client')
it moves to the next one and compains about that.
我试图将其添加到该模块的 gradle.settings
中像这样:
I tried to add it to gradle.settings
in that module like so:
include('client')
include('cache')
但是我仍然遇到相同的错误。我什至尝试将其添加到 gradle.settings
But I still get the same error. I even tried adding this to the gradle.settings
project('lib/cache').projectDir = "$rootDir/lib/cache" as File
相同的结果。
4.4级
Gradle 4.4
主gradle.build文件:
main gradle.build file:
subprojects {
dependencies {
compile project('client')
compile project('cache')
}
repositories{
jcenter()
mavenCentral()
}
}
configure(subprojects){
apply plugin: 'maven'
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'eclipse'
}
repositories {
}
buildscript {
ext {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
}
dependencies {
jcenter()
mavenCentral()
}
推荐答案
添加Java在您的父代构建之上的插件,对我来说这有效:
Add the java plugin on top of your parent build, for me this works:
应用插件:'java'
apply plugin:'java'
它建议在此使用-第二个答案找不到方法compile()作为参数Gradle
还要用存储库切换依赖项-至少在您在此处编写的build.gradle示例中,它们已被切换。
It is recommended here - the second answer Could not find method compile() for arguments Gradle And also switch the 'dependencies' with 'repositories' - at least in the sample of build.gradle you wrote here they are switched.
这篇关于找不到多模块项目的方法compile()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!