How do I configure my Gradle build to download artifacts from Nexus Repository 2?

Visit my.sonatype.com for documentation on Nexus Repository version 2.

Easy, here's a sample build.gradle file that is configured to download artifacts from a local instance of Nexus Repository 2 running on port 8081. All you need to do is define the Maven URL as follows under "repositories/maven/url". This example assumes that your public group doesn't require authentication.

apply plugin: 'java'
apply plugin: 'maven'

repositories {
    maven {
          url "http://localhost:8081/nexus/content/groups/public"
    }
}

dependencies {
    testCompile "junit:junit:3.8.1"
    compile "org.jbundle.util:org.jbundle.util.jbackup:2.0.0"
    compile "net.sf.webtestfixtures:webtestfixtures:2.0.1.3"
    compile "org.shoal:shoal-gms-api:1.5.8"
    compile "org.ow2.util:util-i18n:1.0.22"
    compile "com.sun.grizzly:grizzly-lzma:1.9.19-beta5"
}

Use this for your build.gradle and run "gradle build". Gradle will then retrieve artifacts from your Nexus Repository 2 instance.

More detail and other options of a more global configuration can be found in the Nexus documentation

Have more questions? Submit a request

0 Comments

Article is closed for comments.