Effective sharing of artifacts in Gradle multi project


(Andriy) #1

Hi

Let’s say I have such Gradle multi module projects:
project1:

  •    module A (build.gradle)
    
  •    module B (build.gradle)  
    

project2:

  •    module C (build.gradle) -> uses project1:moduleA
    
  •    module D (build.gradle) -> uses project1:moduleB
    

project3: bundles modules A, B, C, D into one tar archive which is to be deployed.

modules A, B, C, D - they all are published into Artifactory as a central repository setup. if let’s say I change module A, then there is a bit of overhead to publish it to Artifactory first before being able to bundle the whole project locally and see if everything works, also other developers can grab something that is not working as expected. I know Gradle doesn’t support publishing to local repos. So should I use Maven publishing to local repo or I’m doing things wrong here with Gradle and maybe I should think about restructuring everything? Could u please point to some resource on how to solve that with Gradle capabilities?


(Lance Java) #2

It sounds like you’re wanting the new composite build support feature.

Other options including prezi pride and dependency substitution rules discussed [here] (http://stackoverflow.com/questions/32608433/gradle-buildship-switch-dependency-between-jar-and-projects#32609738)


(Stefan Oehme) #3

Gradle totally supports publishing to local repos.


(Andriy) #4

I meant something like Maven local repo… when you can say mvn install and get artifact on your local machine. I know I can use mavenLocal() repo, just wanted to clarify if that is the right solution


(Stefan Oehme) #5

Yes, Gradle can do that. Both the maven plugin as well as the (incubating) maven-publish have tasks for installing to mavenLocal().


(Andriy) #6

Is this a standard actually for Gradle to publish everything to local maven repo or more like a ‘workaround’ in my situation? What would u recommend in my particular case via existing capabilities (while composite build support is on it’s way)?


(Stefan Oehme) #7

It’s what many people do, but you should also consider @Lance_Java’s suggestions. Take whatever works best for you until composite build is there :slight_smile: