I have been "sneaker-netted" a set of jars that I will eventually publish to a Gradle-friendly repo (Artifactory) but that, for the time being, have to stay local on my machine.
I need to use these jars in a Gradle project that not only needs to be able to list these as dependencies
but that also uses the Eclipse plugin to resolve dependencies inside my Eclipse IDE.
These jars all have POMs and have their own transitive dependencies (all of which are in typical repos like Maven Central and JCenter, etc.).
I am looking for a way to save these jars somewhere on my file system but then resolve them like they are normal dependencies
, including resolution of their transitive dependencies, and also for this to be compatible with however the Gradle Eclipse plugin works under the hood.
Again, the desired outcome would be:
~/special-jars/*
gradle eclipse
, Gradle pulls them in from the file system as wellIs this possible to do? If so, how?
Sounds like you want to store your jars in a local maven repository.
Local Maven Repo lives here by default ~/.m2/repository
With a local maven repository the directory structure will be strict for example here is gson on my local
$ ls -d $PWD/*
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2-javadoc.jar
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2-javadoc.jar.sha1
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2-sources.jar
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2-sources.jar.sha1
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.jar.sha1
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.pom
/Users/some.user/.m2/repository/com/google/code/gson/gson/2.6.2/gson-2.6.2.pom.sha1
Using this I can use the typical gradle dependency with transitive dependencies.
repositories {
mavenLocal()
}
dependencies {
compile "com.google.code.gson:gson:2.6.2"
}
You could import the jars through a flatdir
however you will loose the transitive dependencies declared in the pom.