'Gradle override subprojects property from CLI

I'm trying to override a setting in a certain project by using the command line in a Linux environment. I would like to avoid to change the build.gradle file.

Here the build.gradle part that I would like to override:

subprojects {
    ...
    task dist(dependsOn: ['jar']) {
        ...
        Set<String> rootProject = ["aaa", "ccc"]
        ...
    }
}

The objective is to change to something like Set<String> rootProject = ["aaa", "bbb", "ccc"].

I have little experience with gradle, and I tried with ./gradlew clean jar dist -P'org.gradle.subprojects.task.dist(dependsOn: ['jar']).rootProject=["aaa", "bbb", "ccc"]', but unsuccessfully.

Is there a way to override it from CLI?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source