What is the preferred gradle approach to locally install an artifact? (equivalent to maven's "install")

First question is if you need such a place. For example, if you have a single multi-project build rather than many small builds, you won’t need such a place, and won’t have versioning issues between the components of your application. This is a convenient model. Another solution is to have your CI server constantly building snapshots which are then used in dependent builds. Again, this model is more reliable than exchanging artifacts via a local repository.

If you do need a local repository, only use Maven local if it’s necessary to exchange artifacts with Maven builds. Otherwise it’s better to declare a Maven or Ivy repository with a ‘file://’ URL.

PS: The Gradle cache is a cache in the real sense of the word. It’s only reason of existence is performance optimization. It isn’t possible to install anything there, which is important to achieve reproducible builds.

1 Like