manrilla
manrilla

Reputation: 31

Gradle - Subprojects in nested directories

Currently I am on gradle 4.10.2, but am anticipating having to move to gradle 5.0, so I am trying to address any deprecation warnings related to gradle 5.0.

I have the following gradle files in my project: settings.gradle: (in acfs, i.e. root, folder)

rootProject.name = "acfs"
include 's/p/w/manager:code'
include 's/p/w/manager:distribution'

build.gradle: (in acfs/s/p/w/manager/code folder)

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 '**/*'
    }
}

From a command prompt at the acfs folder, if I run gradle clean build --warning-mode all I get the following warning:

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).

Trying to address the above warning, following what is suggested in the above link, I modify settings.gradle to:

rootProject.name = "acfs"
include 's/p/w/manager:code'
include 's/p/w/manager:distribution'
project(':s/p/w/manager').name = "manager"

If I then run gradle clean build --warning-mode all I no longer get the warning, however, I get the following error:

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.

If I instead modify settings.gradle to, based on 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'

When I then run gradle clean build --warning-mode all it is successful, and there are no warnings. However, the build artifact is not generated.

What am I doing wrong in settings.gradle, and/or, is there something I need to modify in the build.gradle file?

Upvotes: 2

Views: 1620

Answers (1)

manrilla
manrilla

Reputation: 31

After spending several days getting nowhere, I figured out what I was doing wrong about an hour after posting this facepalm. I needed to update the value of project.ext.artifactFrom in a common.gradle file

Upvotes: 1

Related Questions