Apply dependency configuration to multiple dependencies


(kevin.loveland) #1

It would be great to apply configuration to multiple dependencies at once.

This is valid:

dependencies {
 compile(
  [group: 'org.apache.cxf', name: 'cxf-rt-core', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxrs', version: '2.6.10'])
}

This is valid:

dependencies {
 compile(group: 'org.apache.cxf', name: 'cxf-rt-core', version: '2.6.10') {
  exclude(module: 'geronimo-javamail_1.4_spec')
 }
 compile(group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '2.6.10']) {
  exclude(module: 'geronimo-javamail_1.4_spec')
 }
 compile(group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: '2.6.10']) {
  exclude(module: 'geronimo-javamail_1.4_spec')
 }
 compile(group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxrs', version: '2.6.10']) {
  exclude(module: 'geronimo-javamail_1.4_spec')
 }
}

This is not:

dependencies {
 compile(
  [group: 'org.apache.cxf', name: 'cxf-rt-core', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxws', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-transports-http', version: '2.6.10'],
  [group: 'org.apache.cxf', name: 'cxf-rt-frontend-jaxrs', version: '2.6.10']) {
  exclude(module: 'geronimo-javamail_1.4_spec')
 }
}

(Peter Niederwieser) #2

Thanks for the suggestion. There are already (too) many syntax variations, and it’s unlikely that we are going to add more. A better approach here would be to exclude the dependency from the whole compile configuration ('configurations.compile.exclude … ').