gpt4 book ai didi

groovy - 如何使用uploadConfigurationName和buildConfigurationName

转载 作者:行者123 更新时间:2023-12-03 06:24:21 25 4
gpt4 key购买 nike

在gradle documentation中,我们可以阅读:

For each configuration in your project, Gradle provides the tasks uploadConfigurationName and buildConfigurationName [18].



据我了解,我可以创建如下所示的构建(没有任何插件,因为我不想在该项目中使用插件):
configurations {
productSrc
}

// create zip file which will be published
buildProductSrc(type: Copy) << {
// do the job
}

// publish zip which were build by buildProductSrc
uploadProductSrc {
repositories {
ivy {
url "http://ivy.repo/repo"
}
}
}

因此,如果我运行 gradle buildProductSrc uploadProductSrc,它将构建zip并将其发布在ivy存储库中。因为它不起作用,我是否正确理解它?

[更新]
根据Peter Niederwieser的回答,这是build的工作版本:
apply plugin: 'base'

configurations {
productSrc
}

// create zip file which will be published
buildProductSrc << { // unable to create specific task, for example 'type: Copy'
// do the job
}

// publish zip which were build by buildProductSrc
uploadProductSrc {
repositories {
ivy {
url "http://ivy.repo/repo"
}
}
}

最佳答案

要获得uploadConfigurationNamebuildConfigurationName任务,您必须应用base插件,或者是依次应用base插件的插件(javagroovy等)。或者,您可以自己声明和配置此类任务(但需要更多的精力)。

关于groovy - 如何使用uploadConfigurationName和buildConfigurationName,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16939900/

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