Is it possible to define custom dependencies (for example jars are in database)?


I have some storage where my jars are located (let’s say that they are in database). Is it possible to specify those dependencies somehow in Gradle? For example, like this:

dependencies {
   compile DB('my_jar')

or maybe I can specify some resolver that will take a look into file extension:

dependencies {
   file 'my_jar.DB'

So if file extension is DB I will download it from database and put locally

Any ideas?


Gradle does not support this out of the box. You could implement the DB method your own (e.g. in a custom plugin) that resolves the file from the database. But you’d need to take care of caching etc. on your own. What is quite common though, is to store the the dependency information in a database but keep the artifacts in a repository manager like artifactory or nexus. Can you elaborate a bit about the motivation here? Using a repository manager is usually the way more convenient and considered to be best practice.