gpt4 book ai didi

gradle - Gradle-嵌套目录中的子项目

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

目前,我处于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时,它成功了,并且没有警告。但是,不会生成构建 Artifact 。

我在settings.gradle中做错什么,和/或在build.gradle文件中是否需要修改?

最佳答案

在花了好几天没有结果之后,我发现发布此facepalm大约一个小时后我做错了什么。我需要在common.gradle文件中更新project.ext.artifactFrom的值

关于gradle - Gradle-嵌套目录中的子项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56580944/

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