Take the 2-minute tour ×

Maven stores artifacts in local repository so i can build library and project separately and library reference (dependency) in project can be resolved if library is already installed in local repository. How to do it using Gradle? (relates to android and java projects)

share|improve this question
Gradle can use both Maven and Ivy repositories. Have you tried publishing to the local maven repository - mavenLocal()? –  Rajesh J Advani Jun 6 '13 at 11:54
it's another case. let's say we've finally migrated from maven to gradle and we don't have local maven repo anymore. is there any possibility to build libs (with tests) and dependent projects with Gradle? –  4ntoine Jun 6 '13 at 12:02
You need a 'common' location that projects can use to share resources. It could be a repository on the internet, on your local network, or a repository that sits on your own PC. mavenLocal() refers to the one on your PC. Or you could use an Ivy repository on your PC too. –  Rajesh J Advani Jun 6 '13 at 12:15
can you provide an example for this? gradle (for android at least) is going to be used to provide the same way of building for both workstation and CI so i wonder how it can manage dependencies which are not in the same folders structure. Let's say i have one lib which is used in 2 projects. Where should it be located at file system? –  4ntoine Jun 6 '13 at 12:28
add comment

1 Answer

CI builds should always share binaries via a binary repository (e.g. Artifactory or Nexus), not via a local repository. If you want to share the library as source, You can have two multi-project builds that both include the library as a subproject. Subprojects can be located anywhere on the file system; for details, see the "multi-project builds" chapter in the Gradle User Guide.

share|improve this answer
thanks! though it seems to make separate building of libraries and projects difficult –  4ntoine Jun 7 '13 at 7:34
add comment

Your Answer


