# How to share outputs between projects

**URL:** <https://discuss.gradle.org/t/how-to-share-outputs-between-projects/44578>\
**Category:** Help/Discuss\
**Created:** [December 30, 2022, 11:47am UTC](https://discuss.gradle.org/t/how-to-share-outputs-between-projects/44578 "2022-12-30T11:47:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![boris](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/boris/32/7842_2.png) [@boris](https://discuss.gradle.org/u/boris)\
**Post date:** [December 30, 2022, 11:47am UTC](https://discuss.gradle.org/t/how-to-share-outputs-between-projects/44578/1 "2022-12-30T11:47:53Z")

</div>

Until now I used the following to create my `war`:

```gradle
tasks.named('war').configure {
	classpath = project.sourceSets.production.runtimeClasspath + project(':shared').sourceSets.production.runtimeClasspath
	...
}

```

However, accessing the `runtimeClasspath` of the other project has been deprecated and gives a warning on Gradle 7.6. So I want to fix that. I spent a lot of time on this and can’t figure out a (good) way to do that.

Actually using just `classpath = project.sourceSets.production.runtimeClasspath` almost works - because the current project depends on `shared` anyway and hence the jars from `shared` come in. The only problem (as far as I can see) is that things declared in `productionRuntimeOnly` in the `shared` project don’t get added to the `war`.

So what’s the “correct” way to migrate that code? Thanks!

---

<div class="post-metadata">

**Author:** ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)\
**Post date:** [January 12, 2023, 2:46pm UTC](https://discuss.gradle.org/t/how-to-share-outputs-between-projects/44578/2 "2023-01-12T14:46:48Z")

</div>

This is the documentation about how to properly share things between projects: [Sharing outputs between projects](https://docs.gradle.org/current/userguide/cross_project_publications.html)

Or maybe you actually want to create a “production” feature variant as documented at [Modeling feature variants and optional dependencies](https://docs.gradle.org/current/userguide/feature_variants.html)
