How to export project dependencies and artifacts to offline maven or ivy repository structure?

Motivation: I’m working on development framework. I would like to create offline (zip) bundle of the framework. It means bundle contains all framework artifacts and its dependencies.

A developer can download the bundle, unzip it, create new application from template, it has maven repo configured with file url the bundle is unzipped to. Now, you can be offline to build the new application that uses my framework. No dependencies are downloaded from internet because all necesarry artifacts are placed in the framework installation directory.

But application that uses my development framework still follow common development and gradle build practices. It means it still uses common maven central and local repositories configured. Developer can use another libraries (that are not part of the framework bundle or newer version of them) that will be downloaded from internet.

My tries to achieve it: I can iterate configuration.runtime and configuration.compile of application template. List of files is perfect but it is just File. I could use it to store it to flat dir. But it is not what I want to do. I miss meta informations about such artifact - name, group, version, dependencies.

I also tried to iterate configurations.allDependencies what has some advantage. It returns meta informations but about only direct dependencies. Info about transitive dependencies are missing. And I also don’t know how to get info about file and it’s POM file URL.

I think gradle provides everything I need to do but I do not know all gradle parts to do it. I need something like my custom proxy repository provider that will delegate to gradle cache to collect all artifact used by project. Or I need to iterate dependency tree and be able to find its file and POM or Ivy metadata file.

It does not matter what format the exported dependencies follow. It can follow maven local offline repository or it can be ivy local offline repository or some gradle specific. I just want to prepare dependencies in structure other gradle projects can use in offline mode.

I hope you understand my motivation. And thanks in advance for your answers.

Best regards, -lk


This has been raised a few times before and it’s something we will do eventually. In the meantime, take a look at There are a few other proxy based approaches like this for capturing what you need. It’s by no means a perfect solution, but may do what you need.

Hi Luke, and thanks for quick reply.

Unfortunately Moxie does not solve my needs. It want to have a development framework sub-module to generate mentioned bundle regularly as part of platform build.

Currently I do not need “nice” Gradle support, I’m just looking for the best way how to do it with current Gradle features. Don’t you really think there is a way how to do with your knowledge of Gradle API?

I can list all runtime depencies: ‘’’ configurations.runtime.each {

println it } ‘’’

And it shows file path to ‘~/.m2/repository’ or ‘~/.gradle/caches’ directories. So I have binaries. What I am missing now is its POM files. I can guest it with ‘.m2’ repo dir changing a file extension. Probably I could also find POM file in ‘.gradle’ cache dir in upper sibling directory. And finally I should “compute” groupId, artifactId and version to place it to the right directory. So I can also parse file URL to do so.

But is it the only way how to do it? Is not here a way to use Gradle API to walk through dependency tree? And is not here a way how to find path to binary and its POM files on local file system?

So thanks again, -lk

There isn’t a way to do this at this time sorry. You’ll have to infer the POM paths.

Ok, thanks.

Thanks for raising this issue as I also need this functionality. Is there anyway you could post your work so I do not have to re-implement this from scratch?