I have a legacy gradle project (version 2.14) and I would like to have a submodule which can run the latest gradle version.
Unfortunately, the legacy project have some constraints to get upgraded.
Is this possible?
If you ask if you can have your main project built with one version of Gradle, while a sub-module is built by another, I am pretty sure you can’t do that in an easy way. The reason is that the entire project, with all its sub-modules, is evaluated in the same version of Gradle. And so all build files need to be compatible with that version.
You could make your sub-module into a stand-alone project, and perhaps invoke it from the main project. But you may have to do a lot of “wiring” to get inputs and outputs right.
Sometimes when I have been working on projects locked into an old version of Gradle which I could not change (because it was hard-coded into CI pipelines that someone else maintained), I made the scripts forward-compatible. That way I could use newer versions of Gradle myself and enjoy the benefits of all the performance improvements, without breaking the build for old versions. The downside to that approach is that a lot of if/else statements may be needed where the DSL/API differs between versions. So from a maintenance perspective, that can be a bit costly.