The Users’ Guide, Section 23.4.7 indicates that I might exclude a transitive dependency this way:
dependencies {
compile("org.gradle.test.excludes:api:1.0") {
exclude module: 'shared'
}
}
Yet when I try basically the identical thing:
dependencies {
...
compile('org.springframework:spring-context:4.1.6.RELEASE')
{
// Exclude Commons Logging in favor of log4j2
exclude module 'commons-logging'
}
}
the build fails with the following error:
> Could not find method compile() for arguments [org.springframework:spring-context:4.1.6.RELEASE, build_830k5onel2vf9qsa5q2e9kr84$_run_closure4$_closure6@4eaecfd8] on root project 'genesyssmsaccess'.
This error goes away if I remove the closure after the compile statement.
What’s the problem here? I’m using gradle 2.11, same as Users’ Guide.