Composite builds and different versions of Gradle wrapper


(Thorsten Schöning) #1

I have a composite build consisting of multiple projects A+B+C, while A provides some plugins to B and C and is therefore included. It’s pretty much used as a replacement for buildSrc in B and C. A needs to use Gradle 5.0 RC1 for some reasons, while B and C do fine with 4.10. When executing gradlew build in A 5.10 is used as expected because of gradle-wrapper.properties. The problem is that when executing the same in B or C the build fails with compilation errors, because Gradle 4.10 is used and doesn’t provide the necessary API yet.

The docs contain the following sentences:

Included builds do not share any configuration with the composite build, or the other included builds. Each included build is configured and executed in isolation.

That statement doesn’t hold for the wrapper? So, am I expected to always update the wrapper to a compatible version in all projects that might include some other project? I there some way some included project could tell me about who includes it? I don’t see any.

I think I’ve read somewhere that only one and the same wrapper is used, like with multi-project builds(?), but can not find it anymore and would therefore ask for some clarification.

Are there any best practices how to deal with this situation? Sounds like it would be easier to not use the wrapper at all for those projects, but maintain a system wide Gradle installation instead? Or is there some way to invoke the build in one including project in a way such that all included projects are build with there configured wrapper without the need to do so manually?

Thanks!