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

Easy, here's a sample build.gradle file that is configured to download artifacts from a local instance of Nexus 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 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.
Powered by Zendesk