How to skip subproject:buildSrc?

Background: We have gradle version 4.0.1 in top project, and version 5.1 in one subproject thmi_app.

It’s hard to upgrade the version in top project because it uses some internal APIs which is not available or supported in 5.1.

When running gradle build from top level, it fails at subproject:build.

:thmi_app:build (Thread[Task worker,5,main]) started.

……

:thmi_app:buildSrc:compileGroovy

startup failed:

/opt/slave/workspace/btcint_CINT-864_new_qftest_tony/src/thmi_app/buildSrc/src/main/groovy/WhitespacePlugin.groovy: 5: unable to resolve class org.gradle.api.provider.ListProperty

@ line 5, column 1.

import org.gradle.api.provider.ListProperty

^

1 error

:thmi_app:buildSrc:compileGroovy FAILED

:compileGroovy (Thread[Task worker Thread 5,5,main]) completed. Took 4.889 secs.

Stopped 1 worker daemon(s).

:thmi_app:build FAILED

:thmi_app:build (Thread[Task worker,5,main]) completed. Took 5.494 secs.

:thmi_app:buildSrc:compileGroovy FAILED

:compileGroovy (Thread[Task worker Thread 5,5,main]) completed. Took 4.889 secs.

Stopped 1 worker daemon(s).

:thmi_app:build FAILED

:thmi_app:build (Thread[Task worker,5,main]) completed. Took 5.494 secs.

FAILURE: Build failed with an exception.

  • What went wrong:

Execution failed for task ‘:thmi_app:buildSrc:compileGroovy’.

> Compilation failed; see the compiler error output for details.

My question is, before we take a lot of time to upgrade top level gradle version, is there any way to skip the task subproject:buildSrc?

The recommendation is to not have two different Gradle versions required in the same build.
So I would recommend updating the root project.

However your setup feels more like a composite build than a simple multi project one. So you should be able to exclude the sub project thmi_app from the root project’s settings.gradle. This would break any reference you have to this project, that is things like project(':thmi_app').