# Effective sharing of artifacts in Gradle multi project

**URL:** <https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089>\
**Category:** Help/Discuss\
**Created:** [March 10, 2016, 10:47am UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089 "2016-03-10T10:47:34Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ALytvynskyi](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@ALytvynskyi](https://discuss.gradle.org/u/ALytvynskyi)\
**Post date:** [March 10, 2016, 10:47am UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/1 "2016-03-10T10:47:34Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Lance\_Java](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/lance_java/32/787_2.png) [@Lance\_Java](https://discuss.gradle.org/u/Lance_Java)\
**Post date:** [March 10, 2016, 2:28pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/2 "2016-03-10T14:28:45Z")

</div>

It sounds like you’re wanting the new [composite build support](https://discuss.gradle.org/t/exciting-new-buildship-features-coming-up/14728) 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](http://stackoverflow.com/questions/32608433/gradle-buildship-switch-dependency-between-jar-and-projects#32609738))

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [March 10, 2016, 2:40pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/3 "2016-03-10T14:40:55Z")

</div>

> [@ALytvynskyi](#):
>
> I know Gradle doesn’t support publishing to local repos.

Gradle totally supports publishing to local repos.

---

<div class="post-metadata">

**Author:** ![ALytvynskyi](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@ALytvynskyi](https://discuss.gradle.org/u/ALytvynskyi)\
**Post date:** [March 10, 2016, 6:28pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/4 "2016-03-10T18:28:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [March 10, 2016, 6:48pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/5 "2016-03-10T18:48:19Z")

</div>

> [@ALytvynskyi](#):
>
> I meant something like Maven local repo

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

---

<div class="post-metadata">

**Author:** ![ALytvynskyi](https://avatars.discourse-cdn.com/v4/letter/a/cab0a1/32.png) [@ALytvynskyi](https://discuss.gradle.org/u/ALytvynskyi)\
**Post date:** [March 10, 2016, 6:50pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/6 "2016-03-10T18:50:43Z")

</div>

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)?

---

<div class="post-metadata">

**Author:** ![st\_oehme](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/st_oehme/32/5249_2.png) [@st\_oehme](https://discuss.gradle.org/u/st_oehme)\
**Post date:** [March 10, 2016, 6:55pm UTC](https://discuss.gradle.org/t/effective-sharing-of-artifacts-in-gradle-multi-project/15089/7 "2016-03-10T18:55:52Z")

</div>

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 🙂
