Gradle: 2.4, 2.5, 2.6
The following project defines subproject ‘submodule’ and task 'test’
submodule redefines dependency commons-lang3 and uses it.
Gradle correctly resolves redefined dependency (version 3.4) but uses version 3.1
It’s exprected that gradle will use version 3.4 and no error is printed.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.commons:commons-lang3:3.1'
}
}
project('submodule') {
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.apache.commons:commons-lang3:3.4'
}
}
task test << {
println org.apache.commons.lang3.StringEscapeUtils.escapeXml10('no matter')
}
}
The output:
* What went wrong:
Execution failed for task ':submodule:test'.
> No signature of method: static org.apache.commons.lang3.StringEscapeUtils.escapeXml10() is applicable for argument types: (java.lang.String) values: [no matter]
Possible solutions: escapeXml(java.lang.String), escapeHtml3(java.lang.String), escapeHtml4(java.lang.String), unescapeXml(java.lang.String), escapeCsv(java.lang.String), escapeJava(java.lang.String)
this is because gradle uses commons-lang3 of version 3.1 where method esca[eXml10() is missing.