GradleBuild changes path for invoked tasks

In my root build.gradle, I’ve defined a GradleBuild task like this:

project.task('distribute', type : GradleBuild) {

    startParameter = gradle.startParameter.newInstance()
    tasks = [":subprojectA:displayInfo"]
}

Given that my root project directory called root,
when I run the distribute task, the task that is executed is

:root:subProjectA:displayInfo

How is it that root becomes what looks like a subproject and why does the gradle build task not execute the correct task like this:

:subProjectA:displayInfo

Just me somethings somethings from previous experience when using GradleBuild

  • I always explicitly set the projectDir. (In your case set it to where subprojectA is located).
  • I don’t override startParameter in the way you do. It has never worked for me in the past.

Here’s an example of a more complex GradleBuild invocation if it is on any help: https://github.com/ceylon/ceylon/blob/master/gradle/linked-projects/linked-project.gradle#L109