2016-07-05 185 views
0

下面是我gradle这个构建脚本:春季启动gradle插件messes常春藤依赖配置?

buildscript { 
    repositories { 
    jcenter() 
    } 
    dependencies { 
     classpath("org.springframework.boot:spring-boot-gradle-plugin:1.3.6.RELEASE") 
    } 
} 
apply plugin: 'spring-boot' 
apply plugin: 'base' 

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

repositories { 
    ivy { 
    url 'my.url' 
    } 
} 

dependencies { 
    archives group: 'my.group', name: 'artifact.name', version: '16.06.29.5144', configuration: 'dist' 
} 

在这里面我尝试一个依赖添加到archives配置。这是依赖发布到常春藤回购,它有几个配置,其中一个dist配置。但它没有default配置。现在

,如果我跑gradlew dependencies我得到以下错误:

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 my.group:artifact.name:16.06.29.5144 

当我删除spring-boot插件,然后错误消失了,我看到预期的输出:

archives - Configuration for archive artifacts. 
\--- my.group:artifact.name:16.06.29.5144 

任何想法,为什么spring-boot插件打破对自定义配置的依赖?

回答

1

您的自定义工件看起来是bug/limitation in Gradle的另一个触发器。失败的发生是由于Spring Boot的插件使用了一些逻辑dependency management plugin,除此之外,确保在依赖关系的poms中声明的任何排除都按预期应用。

您可以解决这个问题,在有可能宣布一些额外的排除,通过告诉依赖管理插件不适用的Maven排除语义成本:

dependencyManagement { 
    applyMavenExclusions false 
}