gradle - Gradle - 嵌套目录中的子项目
问题描述
目前我正在使用 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.
如果我改为将 settings.gradle 修改为,基于https://discuss.gradle.org/t/the-name-aaa-bbb-contains-at-least-one-of-the-following-characters-this-has -已弃用且已计划在 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 文件中修改什么?
解决方案
在花了几天时间一无所获之后,我在发布这张facepalm大约一个小时后发现了我做错了什么。我需要在 common.gradle 文件中更新 project.ext.artifactFrom 的值
推荐阅读
- python - 这个广场不动是有原因的吗?
- android - 如何在android studio中从一个活动导航到另一个活动的片段?
- swift - CodingKeys 一致性生成编译器错误
- html - 如何创建带有类别的元描述?
- javascript - 如何根据发送的道具渲染图像?
- powershell - 将 ADPropertyValueCollection 转换为 System.Collections.Hashtable
- java - 关于Android TV中遥控器音量操作的问题
- ios - 多个tableview单元格内的Collectionview,如何处理选择?
- powershell - Find-VBRViEntity 在 veeam 中不返回任何实体
- c# - UnityWebRequest 到 UnityEngine.ResourceRequest?