当前我处于gradle 4.10.2上,但是预计必须升级到gradle 5.0,所以我试图解决与gradle 5.0相关的所有弃用警告。
我的项目中有以下gradle文件: settings.gradle :(在acfs中,即根目录,文件夹)
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.
如果我改为根据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将settings.gradle修改为:
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文件中进行一些修改吗?
答案 0 :(得分:0)
花了几天时间无所事事后,我发现发布此 facepalm 大约一个小时后,我做错了什么。我需要在common.gradle文件中更新project.ext.artifactFrom的值