Loading...

August 5, 2014

Grails Goodness: Using Bintray JCenter as Repository

Bintray JCenter is the next generation (Maven) repository. The repository is already a superset of Maven Central, so it can be used as a drop-in replacement for Maven Central. To use Bintray JCenter we only use jcenter() in our repositories configuration block in BuildConfig.groovy. This is the same as we would use in a Gradle build.

// File: grails-app/conf/BuildConfig.groovy
...
repositories {
    ...
    // Configure Bintray JCenter as repo.
    jcenter()
    ...
}
...

We can also set the update and checksum policies by applying a configuration closure to the jcenter method:

// File: grails-app/conf/BuildConfig.groovy
...
repositories {
    ...
    // Configure Bintray JCenter as repo.
    jcenter {
        // Allowed values: never, always, daily (default), interval:seconds.
        updatePolicy 'always' 
        // Allowed values: fail, warn, ignore
        checksumPolicy 'fail'
    }
    ...
}
...

Code written with Grails 2.4.2.