【发布时间】:2019-06-13 12:51:28
【问题描述】:
目前我正在使用 gradle 4.10.2,但预计必须迁移到 gradle 5.0,因此我正在尝试解决与 gradle 5.0 相关的任何弃用警告。
我的项目中有以下 gradle 文件: settings.gradle:(在acfs中,即root、文件夹)
rootProject.name = "acfs"
include 's/p/w/manager:code'
include 's/p/w/manager:distribution'
build.gradle:(在 acfs/s/p/w/manager/code 文件夹中)
apply from: "$projectDir/../../common.gradle"
apply plugin: 'war'
war {
// Note: this also determines the context path.
archiveName "${parent.name}.war"
from('src/main/web/resources') {
into 'resources'
include '**/*'
}
}
在 acfs 文件夹的命令提示符下,如果我运行 gradle clean build --warning-mode all,我会收到以下警告:
The project name 's/p/w/manager' contains at least one of the following characters: [ , /, \, :, <, >, ", ?, *, |]. This has been deprecated and is scheduled to be removed in Gradle 5.0. Set the 'rootProject.name' or adjust the 'include' statement (see https://docs.gradle.org/4.10.2/dsl/org.gradle.api.initialization.Settings.html#org.gradle.api.initialization.Settings:include(java.lang.String[]) for more details).
为了解决上述警告,按照上面链接中的建议,我将 settings.gradle 修改为:
rootProject.name = "acfs"
include 's/p/w/manager:code'
include 's/p/w/manager:distribution'
project(':s/p/w/manager').name = "manager"
如果我随后运行 gradle clean build --warning-mode all 我不再收到警告,但是,我收到以下错误:
Could not determine the dependencies of task 'manager:code:compileJava'.
> Could not resolve all dependencies for configuration ':manager:code:compileClasspath'
> Project :manager:code not found.
如果我改为将 settings.gradle 修改为,基于https://discuss.gradle.org/t/the-name-aaa-bbb-contains-at-least-one-of-the-following-characters-this-has-been-deprecated-and-is-scheduled-to-be-removed-in-gradle-5-0/24173:
rootProject.name = "acfs"
include 's:p:w:manager:code'
include 's:p:w:manager:distribution'
当我运行gradle clean build --warning-mode all 时,它是成功的,并且没有警告。但是,不会生成构建工件。
我在 settings.gradle 中做错了什么,和/或我需要在 build.gradle 文件中修改什么?
【问题讨论】:
标签: gradle build.gradle