1

Project structure:

+ root
  + lib-test1
    - build.gradle
    - settings.gradle
  + lib-test2
    - build.gradle
    - settings.gradle

The settings.gradle file of my test2:

include ':lib-test1'

project(':lib-test1').projectDir = new File(settingsDir, '../lib-test1')

rootProject.name = 'lib-test2'

The build.gradle file of my test2:

dependencies {
    compile project(':lib-test1')  // line 38
}

When I try to refresh the gradle tasks, it failed on my 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'.

But there is nothing wrong when I build my test1. And the weird thing is that when I run it in command line, it ran fine?

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

I've also tried to clean the project by running the following on both of my projects:

./gradlew cleanEclipse
./gradlew cleanEclipseProject
./gradlew cleanEclipseClasspath
./gradlew eclipse

Any idea what else I am missing or why it is failing?

codenamezero
  • 2,724
  • 29
  • 64

0 Answers0