gpt4 book ai didi

gradle - 用`implementation`代替`compile`替换`fileTree`会干扰复制库任务

转载 作者:行者123 更新时间:2023-12-03 04:57:08 27 4
gpt4 key购买 nike

我正在将一个项目迁移到Gradle。

我有一些通过compile fileTree(dir: "libs/$it", include: '*.jar')导入的本地部门

但是,不建议使用compile

但是如果我将其更改为implementation
那么我的任务将什么都不会复制(除了用runtime清除的文件):

task copyToLib(type: Copy) {
from configurations.runtime
into "$buildDir/output/lib"
}

configurations.runtime更改为 .compileimplementation并没有帮助

这是怎么回事?

最佳答案

documentation on the Gradle Java plugin显示配置runtime已被弃用。它被runtimeOnly配置所取代,该配置就像其名称一样,仅提供运行时相关性。但是,还有另一个称为runtimeClasspath的配置,该配置扩展了runtimeOnlyruntimeimplementation的配置。

因此,只需替换示例中的配置即可:

task copyToLib(type: Copy) {
from configurations.runtimeClasspath
into "$buildDir/output/lib"
}

关于gradle - 用`implementation`代替`compile`替换`fileTree`会干扰复制库任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57110533/

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