Nikem Nikem - 1 year ago 190
Java Question

spring-boot gradle plugin messes ivy dependency configuration?

Below is my gradle build script:

buildscript {
repositories {
dependencies {
apply plugin: 'spring-boot'
apply plugin: 'base'

task wrapper(type: Wrapper) {
gradleVersion = '2.12'

repositories {
ivy {
url 'my.url'

dependencies {
archives group: '', name: '', version: '', configuration: 'dist'

In it I try to add one dependency to
configuration. This is dependency published into Ivy repo and it has several configuration, among them a
configuration. But it does not have

Now, if I run
gradlew dependencies
I get the following error:

Execution failed for task ':dependencies'.
Could not resolve all dependencies for configuration 'detachedConfiguration4'.
> Module version :gtest:unspecified, configuration 'detachedConfiguration4' declares a dependency on configuration 'default' which is not declared in the module descriptor for

When I remove
plugin, then error disappears and I see expected output:

archives - Configuration for archive artifacts.

Any ideas why
plugin breaks dependency on custom configuration?

Answer Source

Your custom artifact looks to be another trigger of a bug/limitation in Gradle. The failure's occurring due to some logic in the dependency management plugin that Spring Boot's plugin uses that, among other things, ensures that any exclusions declared in dependencies' poms are applied as intended.

You can work around the problem, at the cost of perhaps having to declare some additional exclusions, by telling the dependency management plugin not to apply Maven exclusion semantics:

dependencyManagement {
    applyMavenExclusions false
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download