Multi-project build using different task name

I have a master project with multiple sub-projects, organized using “includeFlat”. One of the sub-projects comes from a vendor, who supplies a with the instructions to invoke it via “gradle release” – i.e. the task to run is called “release”.

When I run “gradle build” in the master project, I need to execute “gradle release” in this particular sub-project in order to run the build as supplied by the vendor. How do I do that?

I don’t want to change the vendor’s source at all, including the vendor’s build.gradle file.

I have tried adding the following to the master build.gradle file:

project (‘subproject’) {
defaultTasks ‘release’

… but gradle still runs “gradle build” in the sub-project.

I also tried:

task build {
	dependsOn 'release'

… but gradle complained ‘Declaring custom ‘build’ task when using the standard Gradle lifecycle plugins is not allowed.’ And even if this worked, it would still run the ‘build’ task in addition to the ‘release’ task. I need to run ‘release’ instead of ‘build’, not in addition to ‘build’.