I have a clean install of Gradle 4.10.1
------------------------------------------------------------
Gradle 4.10.1
------------------------------------------------------------
Build time: 2018-09-12 11:33:27 UTC
Revision: 76c9179ea9bddc32810f9125ad97c3315c544919
Kotlin DSL: 1.0-rc-6
Kotlin: 1.2.61
Groovy: 2.4.15
Ant: Apache Ant(TM) version 1.9.11 compiled on March 23 2018
JVM: 10.0.2 ("Oracle Corporation" 10.0.2+13)
OS: Windows 10 10.0 amd64
I have a structure of
/settings.gradle
/build.gradle
/subproject/build.gradle
/subproject/subsub/build.gradle
/settings.gradle =
include ':subproject'
include ':subproject:subsub'
/build.gradle =
apply plugin : 'java'
allprojects {
apply plugin: 'java'
repositories {
mavenCentral()
}
}
/subproject/build.gradle =
configurations {
java
}
dependencies {
java project( path: 'subsub', configuration: 'compile' )
}
/subproject/subsub/build.gradle is empty
executing gradle results in
FAILURE: Build failed with an exception.
* Where:
Build file '...\subproject\build.gradle' line: 6
* What went wrong:
A problem occurred evaluating project ':subproject'.
> Could not find method java() for arguments [DefaultProjectDependency{dependencyProject='project ':subproject:subsub'', configuration='compile'}] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
This seems to be a similar failure as Could not find method compile() for arguments
however the suggestion here is that the configuration is not available as it’s created in the plugin and yet my example here explicitly creates the java configuration so surely should be available already?