There is no way to have per-dependency excludes while still being able to use the compile 'com.google.guava:guava:17.0'
syntax. configurations.compile.exclude ...
will only affect the compile
configuration (and configurations inheriting from it), and is almost always preferable over per-dependency excludes.
Another solution is to factor out dependency declarations with something like:
ext.libs = [
error_data_ioc: dependencies.create("org.jboss.errai:errai-data-ioc:2.4.4.Final") {
exclude group: 'com.google.gwt'
exclude group: 'com.google.guava'
}
]
Then you can reuse these declarations wherever you need them (e.g. dependencies { compile libs.error_data_io }
; also works from a subproject). If you really wanted, you could also share the same { exclude ... }
block among multiple declarations (by assigning it to a local variable).