Gradle subproject name different than folder name

前端 未结 1 1194
半阙折子戏
半阙折子戏 2021-01-31 07:24

I have a couple of subprojects that are part of a multi-project build (flat hierarchy). I want to set the name on them to be different than their folder name. However in include

相关标签:
1条回答
  • 2021-01-31 07:46

    Project names can only be changed in settings.gradle. For example:

    include "foo" // or `includeFlat`, doesn't matter
    
    // always good to nail down the root project name, because
    // the root directory name may be different in some envs (e.g. CI)
    // hence the following even makes sense for single-project builds
    rootProject.name = "bar" 
    
    // change subproject name
    project(":foo").name = "foofoo"
    

    Alternatively, you can use the desired project name in the include statement, and later reconfigure the project directory:

    include "foofoo"
    
    project(":foofoo").projectDir = file("foo")
    

    To give some background, the only difference between include and includeFlat is that they use different defaults for the project's projectDir. Otherwise they are the same.

    For further information, check out Settings in the Gradle Build Language Reference.

    0 讨论(0)
提交回复
热议问题