currently, I\'m testing Gradle as an alternative to Maven. In my projects, there are some 3rd party jars, which aren\'t available in any (Maven) repositories. My problem is
Used option (1) out of Adam Murdoch post (already linked above: http://gradle.1045684.n5.nabble.com/Gradle-Make-a-3rd-party-jar-available-to-local-gradle-repository-td1431953.html) with gradle-1.3 and it works just nicely!
Here his comment:
- Copy the jars to a local directory and use a flatDir() repository to use them out of there. For example, you might copy them to $projectDir/lib and in your build file do:
repositories { flatDir(dirs: 'lib') }
The files in the lib directory must follow the naming scheme: name-version-classifier.extension, where version and classifier are optional. So, for example you might call them groovy-1.7.0.jar or even groovy.jar
Then, you just declare the dependencies as normal:
dependencies { compile 'groovy:groovy:1.7.0' }
There's a little more detail one flatDir() repository at: http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#sec:flat_dir_resolver
- Similar to the above, but using an ivy resolver instead of flatDir(). This is pretty much the same as the above, but allows a lot more options as far as naming and locations go.
There's some detail at: http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#sub:more_about_ivy_resolvers
- Don't bother with declaring the dependencies. Just copy the jars to a local directory somewhere and add a file dependency. For example, if the jars are in $projectDir/lib:
dependencies { compile fileTree('lib') // this includes all the files under 'lib' in the compile classpath }
More details at: http://gradle.org/0.9-preview-1/docs/userguide/dependency_management.html#N12EAD
- Use maven install to install the dependencies into your local maven cache, and the use the maven cache as a repository:
repositories { mavenRepo(urls: new File(System.properties['user.home'], '.m2/repository').toURI().toURL()) }