java Gradle:配置运行时声明了对配置默认值的依赖,它没有在模块描述符中声明

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35705148/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-11-03 00:29:06  来源:igfitidea点击:

Gradle: configuration runtime declares a dependency on configuration default which is not declared in the module descriptor for

javagradlerepositoryivy

提问by dariobronx

Can you tell me why when I run gradle I get this error:

你能告诉我为什么当我运行 gradle 时出现这个错误:

Error:Module version trestGradle:trestGradle:1.0-SNAPSHOT, 
configuration 'runtime' declares a dependency on 
configuration 'default' which is not declared in the module 
descriptor for it.develop:myLib:1.0.0"

What is needed to be declared on the ivy.xml (module descriptor)?

需要在 ivy.xml(模块描述符)上声明什么?

  • MyLib is on an internal ivy repository

  • I checked:credentials, ivy url and the pattern

  • MyLib 位于内部常春藤存储库中

  • 我检查了:凭据,常春藤网址和模式

build.gradle:

构建.gradle:

group 'trestGrad'
version '1.0-SNAPSHOT'

apply plugin: 'java'

sourceCompatibility = 1.5

configurations {
    compile
}

repositories {
    ivy {
        url = 'http://example.com/artifactory/cst'
        credentials {
            username = "user"
            password = "pass123"
        }
        layout('pattern') {
            // Pattern to resolve Ivy descriptor files.
            ivy '[organization]/[module]/[revision]/[type]s/ivy.xml'
            // Pattern to resolve files.
            artifact '[organization]/[module]/[revision]/[type]s/[module].[ext]'
        }
    }
}

dependencies {
    compile "it.develop:myLib:1.0.0"
}

回答by RaGe

See here.

这里

You need to specify the configuration for your dependency. Failing which ivy assumes defaultconfiguration and hence your error message.

您需要为您的依赖项指定配置。失败的常春藤假设default配置,因此您的错误消息。