Storing artifacts in project directory


(Bernd Dutkowski) #1

Is there a way to use Gradle dependencies management and keep the artifacts in an project directory? We want to keep all artifacts under revision control and in an Repository.


(Peter Niederwieser) #2

You have several options:

  • Use a local (‘file:///’) Maven or Ivy repository (and commit it to source control). * Use a ‘flatDir’ repository. * Directly add files/directories to configurations (e.g. ‘dependencies { compile files(“path/to/my.jar”) }’).

If you choose the first option, you’ll also get transitive dependency management.

For more information, see the dependency management chapters in the Gradle User Guide.


(Bernd Dutkowski) #3

My first idea was to move the artifact-cache to a sub-dir in my project using the “-g” switch. With that, i got all artifacts in place and would be able put them under revision control and keep the dependencies management i like so much. It is even possible to use “–offline”. But this has tow major drawbacks: i got my project polluted with ‘buildscript’ files i didn’t need there and i have to use an extra command line switch.

Using an file-based maven repo. could work, but i couldn’t find a way to get the artifacts from remote repos. automatically moved to the file-based repo. Did i missed here something? Usually the Gradle documentation is very good.

thx for your help!


(Peter Niederwieser) #4

Committing the Gradle cache is not a viable solution, for various reasons.

Using an file-based maven repo. could work, but i couldn’t find a way to get the artifacts from remote repos. automatically moved to the file-based repo.

That’s a challenge you’d have to solve yourself, and it’s one of the reasons why using a repository manager (Artifactory, Nexus, etc.) is usually preferable.