How do I make additional Jars available to other projects in the same build?


In a multi-project build project A depends on project B, where B builds more archive jar artifacts. These artifacts are added to B by their creator tasks: artifacts {

archives jarApi

archives jarImpl

… }

However, on compiling A these artifacts are ignored by gradle, it keeps searching for and then fails to find the “default” single jar archive, hence compilation fails finding of classes from B. (All this is in 1.0-milestone-6)

Am I missing something?


To make additional Jars available to other projects, you need to add them to the ‘runtime’ configuration. If you add them to the ‘archives’ configuration, they will get published but won’t appear on other class paths. One example where this is handy is sources and Javadoc Jars.

For additional information, see the migration guide for Gradle 1.0-milestone-5.

I should make reading release materials a habit, it seems.

Thanks, Peter!