繁体   English   中英

spring-boot gradle插件将常春藤依赖配置弄乱了吗?

[英]spring-boot gradle plugin messes ivy dependency configuration?

以下是我的gradle构建脚本:

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配置添加一个依赖项。 这是发布到Ivy repo中的依赖项,它具有多个配置,其中包括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插件会打破对自定义配置的依赖?

您的自定义工件看起来是Gradle中错误/限制的另一个触发因素。 发生该故障是由于Spring Boot插件使用的依赖管理插件中的某些逻辑所导致的,除其他外,该逻辑确保了按预期应用依赖项poms中声明的任何排除项。

您可以通过告诉依赖项管理插件不要应用Maven排除语义,以可能不得不声明一些其他排除的代价来解决此问题:

dependencyManagement {
    applyMavenExclusions false
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM