Gradle: Share compile/runtime Dependencies between repos

(Jan Schmitz-Hermes) #1

Hey guys.

For a couple of days I am struggling with the following question:
I have the following setup: two git repositories that share exactly the same build logic (which is: Arquillian integration tests). This means they have a custom source set, a couple of custom dependency scopes, some tasks they share, a plugin they both need and - of course - the Arquillian dependencies. This is quite a lot to have duplicated, so I would like to share the logic between repositories.

I know I can create a script plugin, put it to a web server and all works. But that’s not what I want (there are times where we work without Internet, e.g. trains/planes).
I could also create a script plugin and create a git submodule and share the build logic like this, but actually that feels kinda hacky.

What I actually want is to create a Gradle plugin and all the projects that need integration tests simply depend on this plugin.

I just do not now how to share the dependencies via the plugin.

TL;DR: Let me rephrase the question: is there any known possibility to declare dependencies (and dependency scopes and custom source sets) in a Gradle plugin that - in turn - are available in the classpath of the Gradle project that depends on the plugin?

If yes I’d be glad to know how that is possible. If no: I would be glad to here about the design decision that makes that impossible :slight_smile:

Thank you guys!