Add an alias for multi projects on include

Please add an alias for multi projects. Because we use eclipse all our projects are parallel. Our settings.gradle in the main project look like:

include '../SubA'
include '../SubB'

This result in difficult syntax like:

dependsOn(':../SubA:jar')

which also not work on every place. It will be nice if there can be set an alias for a project on the include line like:

include '../SubA' as SubA
include '../SubB' as SubB

You can already achieve it by changing child project directories:

include 'SubA'
include 'SubB'
  rootProject.children.each { project ->
    project.projectDir = new File(settingsDir.parentFile, project.name)
}

Thank you Marcin. I use now:

include ‘SubA’ include ‘SubB’

rootProject.children.each {project ->

switch( project.name ) {

case ‘SubA’: project.projectDir = new File(’…/SubA’); break

case ‘SubB’: project.projectDir = new File(’…/SubB’); break

} }

Why don’t you want to keep your solution generic?

include 'SubB'
rootProject.children.findAll { it.name in ['SubA', 'SubB'] }.each { project ->
    project.projectDir = new File(settingsDir.parentFile, project.name)
}

Also, you should never use the ‘File’ constructor that accepts a single ‘String’ argument because the file it points at will depend on where you run Gradle from. You should always use ‘settingsDir’ variable as your reference point.