There is the following structure
MainProject settings.gradle build.gradle Proj1 build.gradle Proj2 build.gradle In the MainProject/settings.gradle I prescribe projects
include 'Proj1', 'Proj2' Proj2 depends on Proj1 .
If I write in Proj2/build.gradle
dependencies { compile project(':Proj1'); } Gradl does not see classes from Proj . If I describe the same thing in MainProject/build.gradle
project(':Proj2') { dependencies { compile project(':Proj1') } } Then everything will compile correctly (from the account that the Proj2/gradle.build will not be).
Why option 1 does not work? This is better in the sense that all the logic will be contained in its own build.gradle build.gradle , and not in one general.
PS Update
In the comments asked to make a minimal gitovogo project .
If you directly clone and run gradle compileJava from the root, everything will be compiled.
If you do the following:
In the root
build.gradlecomment out from 5 to 10 linesproject(':Proj2') {...}Rename
Proj2/b2uild.gradle2toProj2/build.gradleand rungradle compileJava- then the error described above will occur.
my @ ubuntu: ~ / Projects / TempGradle $ gradle -version
Gradle 3.0
Build time: 2016-08-15 13:15:01 UTC
Revision: ad76ba00f59ecb287bd3c037bd25fc3df13ca558
Groovy: 2.4.7
Ant: Apache Ant (TM) version 1.9.6 compiled on June 29 2015
JVM: 1.8.0_102 (Oracle Corporation 25.102-b14)
OS: Linux 3.13.0-96-generic amd64