Hi guys,
I created a simple task in one subproject where I print dependencies of some configuration from other project. In some cases this leads to an error: Could not get unknown property ‘compile’ for configuration container. I found out that the first project name affects to the error occurrence.
Project structure:
/
| - build.gradle
| - build-jar.gradle
| - build-ear.gradle
| - settings.gradle
Files content:
- build.gradle
task wrapper(type: Wrapper) {
gradleVersion = “2.14.1”
}
- build-jar.gradle
project(":jar") {
apply plugin: ‘java’
repositories {
mavenCentral()
}
dependencies {
compile 'commons-lang:commons-lang:2.4'
}
}
- build-ear.gradle
project(’:ear’) {
task customTask() {
println ‘>>>’ + project(’:jar’).configurations.compile.dependencies
}
}
- settings.gradle
include ‘:jar’, ‘:ear’
project(’:jar’).buildFileName = "…/build-jar.gradle"
project(’:ear’).buildFileName = “…/build-ear.gradle”
If you try to execute ‘clean’ task, you will get the error. But if the ‘ear’ project name will be changed to ‘tear’ as example in build-ear.gradle and settings.gradle files the error disappear.
build_files.zip (945 Bytes)
Gradle: 2.13 and 2.14.1
JVM: 1.8.0_31 (Oracle Corporation 25.31-b07)
OS: Windows 7 6.1 amd64