Gradle monobuild and map of jar files for all gradle composite builds

We have a directory structure like so

  • java
    • build/build.gradle (This does NOT exist yet, but we want this)
    • servers
      • server1/build.gradle
      • server2/build.gradle
    • libraries
      • lib1/build.gradle
      • lib2/build.gradle

We have 11 servers and 14 libraries with varying uses of dependencies. EACH server is a composite build ONLY depending on libraries (we don’t allow servers to depend on each other). In this way, as our mono-repo grows, opening up server1 does NOT get slower and slower as more and more gradle code is added(ie. gradle only loads server1 and all it’s libraries and none of the other libraries OR servers are loaded keeping things FAST).

Ok, so one problem we are running into is duplication now which is why we need build/build.gradle file AND we want EVERY module in our mono repo to include that somehow for a few goals(each goal may need a different solution)

GOAL 1: To have an ext { … } section containing a Map of Strings to gradle dependencies much like so

deps = [
   'web-webserver':      "org.webpieces:http-webserver:${webpiecesVersion}",
   'web-webserver-test': "org.webpieces:http-webserver-test:${webpiecesVersion}",
   'web-devrouter':      "org.webpieces:http-router-dev:${webpiecesVersion}"

In this way, we want ALL our projects to them import dependencies like so

  compile deps['web-webserver']

GOAL 2: We want checkstyle to be defined the SAME for all projects (eventually!!!). We would like the checkstyle gradle to live here but have all libraries somehow pull it in.

IDEALLY, I kind of want configuration injection where when I run server1/build.gradle, it actually runs java/build/build.grade as it’s parent somehow but then all ibraries it uses also use java/build/build.gradle as their parent. I am not sure this is possible or feasible.

Are either of these GOALS possible?


anyone? must be at least 20 characters