gpt4 book ai didi

gradle - 为什么 uploadArchives 没有列在任务列表中?

转载 作者:行者123 更新时间:2023-12-02 00:54:17 24 4
gpt4 key购买 nike

我认为uploadArchives是一个由java插件提供的任务。在我的 build.gradle 中,我使用 java 插件:

apply plugin: 'java'

但是,如果我在命令行上调用 gradle 任务,我将看不到 uploadArchives 任务。

即使不使用 gradle gradletasks --all

uploadArchives 任务在 gradle java 插件文档中列出请参阅http://www.gradle.org/java_plugin (表11)。

我使用 gradle 版本 1.0-milestone-6。

我可以毫无错误地调用 gradle uploadArchives,但任务未列出。

最佳答案

uploadArchives 任务作为规则添加到您的构建脚本中,而不是按名称显式添加。在“gradletasks”的输出中,您应该看到这一行:

Pattern: upload<ConfigurationName>: Assembles and uploads the artifacts belonging to a configuration.

This means, that for each configuration in your build file, an according uploadTask exist. The java plugin adds an configuration named archives to your build script. By adding the configuration "archives" to your build script explicitly by the java plugin, the uploadArchives task is added implicitly too.

There are scenarios, where gradle can't know what tasks need to be materialized by a rule.

E.g.

tasks.addRule("Pattern: ping<ID>") { String taskName ->
if (taskName.startsWith("ping")) {
task(taskName) << {
println "Pinging: " + (taskName - 'ping')
}
}
}

无法确定应该显示哪些 ping 任务,因为它们只是通过“gradle pingServer1 pingServer2 pingServer3”从命令行触发时才实现的

问候,雷内

关于gradle - 为什么 uploadArchives 没有列在任务列表中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8478594/

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