gpt4 book ai didi

gradle - 为依赖项指定了意外状态 'DEV'。预期 : [integration, 里程碑之一,发布]

转载 作者:行者123 更新时间:2023-12-03 05:06:29 32 4
gpt4 key购买 nike

我正在使用 Gradle 和旧版 Ivy 存储库构建项目,其中 jar 是使用自定义 Ivy 状态构建的。不幸的是,Gradle 似乎在这种状态下存在问题,因此我收到错误:
Unexpected status 'DEV' specified for *some_dependecy*:1.0.34. Expected one of: [integration, milestone, release]
这是在 build.gradle 中定义该依赖项的方式

compile 'dependency:some_dependecy:1.0.34'

和存储库定义
    ivy {
url 'http://local-repo/ivy-candidates-local/'
layout 'pattern' , {
artifact '[organisation]/[module]/[revision]/[type]s/[artifact].[ext]'
ivy '[organisation]/[module]/[revision]/ivys/ivy.xml'
m2compatible = true
}

我认为这很好,因为所有其他依赖项(没有“自定义”状态)都被正确下载

我找不到有关此类问题的任何信息。有没有办法告诉 Gradle 寻找自定义的“DEV”状态而不是默认状态?

最佳答案

默认情况下,Gradle 只理解 integration , milestone , 和 release作为有效的工件状态。如果您想要/需要为您的工件保持“DEV”状态,看起来您必须在 build.gradle 中添加一些自定义 Groovy。

https://docs.gradle.org/current/userguide/customizing_dependency_resolution_behavior.html#sec:component_metadata_rules

(来自上面的链接,不是我自己的代码:)

class CustomStatusRule implements ComponentMetadataRule {
@Override
void execute(ComponentMetadataContext context) {
def details = context.details
if (details.id.group == "org.sample" && details.id.name == "api") {
details.statusScheme = ["bronze", "silver", "gold", "platinum"]
}
}
}

dependencies {
config3 "org.sample:api:latest.silver"
components {
all(CustomStatusRule)
}
}

关于gradle - 为依赖项指定了意外状态 'DEV'。预期 : [integration, 里程碑之一,发布],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57462897/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com