项目结构:
+ root
+ lib-test1
- build.gradle
- settings.gradle
+ lib-test2
- build.gradle
- settings.gradle
我的test2的settings.gradle
文件:
include ':lib-test1'
project(':lib-test1').projectDir = new File(settingsDir, '../lib-test1')
rootProject.name = 'lib-test2'
我的test2的build.gradle
文件:
dependencies {
compile project(':lib-test1') // line 38
}
当我尝试刷新gradle任务时,我的test2失败了:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\me\Source\Repos\java\lib-test2\build.gradle' line: 38
* What went wrong:
A problem occurred evaluating project ':lib-test2'.
> Project with path ':lib-test1' could not be found in project ':lib-test2'.
但是我建立test1
时没有错。奇怪的是,当我在命令行中运行它时,运行正常吗?
PS C:\Users\me\Source\Repos\java\lib-test2> .\gradlew build
:lib-test1:compileJava
:compileJava
:processResources NO-SOURCE
:classes
:jar UP-TO-DATE
:assemble UP-TO-DATE
:compileTestJava NO-SOURCE
:processTestResources NO-SOURCE
:testClasses UP-TO-DATE
:lib-test1:processResources NO-SOURCE
:lib-test1:classes
:lib-test1:jar
:test NO-SOURCE
:check UP-TO-DATE
:build UP-TO-DATE
:lib-test1:assemble
:lib-test1:compileTestJava NO-SOURCE
:lib-test1:processTestResources NO-SOURCE
:lib-test1:testClasses UP-TO-DATE
:lib-test1:test NO-SOURCE
:lib-test1:check UP-TO-DATE
:lib-test1:build
BUILD SUCCESSFUL
Total time: 6.475 secs
我还尝试通过在我的两个项目上运行以下内容来清理项目:
./gradlew cleanEclipse
./gradlew cleanEclipseProject
./gradlew cleanEclipseClasspath
./gradlew eclipse
知道我还缺少什么或者为什么会失败?