Nested buildSrc?


(Adrian Abraham) #1

We run a binary repository in-house with a fairly unusual structure. Since we have to set up the repositories a couple of times (once in buildscript{} and once in allmodules{}), I’ve pulled the repository creation code out into a class in buildSrc.

Now, I’d like to move some more code into buildSrc - but it needs to access our repository. My first thought was to move the repo setup code into buildSrc/buildSrc, then call it from buildSrc. This partially worked - buildSrc was able to use the classes defined in buildSrc/buildSrc - but the classes in buildSrc/buildSrc aren’t available to the main build.

Can I get the classes from buildSrc/buildSrc put on the main build classpath? Or, is there a better way to do this?


(Peter Niederwieser) #2

Can I get the classes from buildSrc/buildSrc put on the main build classpath?

Not easily. It’s not a supported feature.

Or, is there a better way to do this?

I recommend to use a repository manager like Artifactory or Nexus. Then you just need to declare a single repository, and duplicating the declaration becomes a non-issue.