Build source dependency with provided Gradle wrapper

Is it possible to build a source dependency with the provided Gradle wrapper instead of the parent project’s version? I’d like to include a project that isn’t compatible with my project’s Gradle version, but provides a wrapper of its own.

Alternatively, is it possible to override the dependency’s build process with a custom command (e.g., ./gradlew build)? I’ve seen the injected-plugins sample project, but can’t seem to figure out how to prevent the dependency’s build.gradle file from being loaded and instead run a different command.

Unfortunately not, source dependencies are basically composite builds with the Git-repository handling on top.
And unfortunately currently all builds in a composite build are executed with the same wrapper.

I didn’t try it so far, but as the injected plugins have to be settings plugins, you should actually be able to change the build script name of the projects to something non-existent and then have the complete build logic in that settings plugin or something similar. But most often it might be easier and more reliable to just update the dependencies Gradle version so that the builds become compatible.

And you might want to have a look at Git Include Gradle Plugin as an alternative to source dependencies which still are an experimental feature and do not get much love currently. But that plugin does not allow injected plugins at all afair, maybe good candidate for a feature request though.

Thanks for your pointers! I’ll look into them next week.