Wednesday, March 17, 2010

Custom Repository Layout in Gradle

For one of the projects I work on with some colleagues, we have a number of jar files, which are not part of any Maven(-ized) repository. We decided to upload these jar files to the downloads page of github, so that we have a url which we can refer to. Using some customization in our Gradle build file, we managed to download these jars as though they were hosted on a Maven(-ized) repository.

usePlugin 'java'

repositories {
mavenCentral()
add(new org.apache.ivy.plugins.resolver.URLResolver()) {
name = "GitHub"
addArtifactPattern 'http://github.com/asikkema/adoptimizer/downloads/[organization]-[module]-[revision].[ext]'
}
}

dependencies {
compile "gdata:client:1.0@jar"
compile "gdata:analytics:2.1@jar"
compile "gdata:analytics-meta:2.1@jar"
}


There are other options, but this was the most terse we came up with.

No comments:

Post a Comment