How I deployed Sonatype Nexus in 5 minutes?

created on 29 December 2014 and tagged under sonatype-nexus install android

I was struggling with Sonatype Nexus since a week. There was three failed attempt to deploy it. Here's how I finally got it to work

Changes in Android's gradle file

The top-level build file is configured, by default, as-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

In more recent version of Android Studio, it will be as-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
    }
}

Android Studio has now shifted to Bintray's jCenter from Maven Central. Anyways, irrespective of this, if you want to proxy Maven Central and have a local repository manager, you just need to replace the configuration as-

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        maven {
            url 'https://<deployment-address>/content/repositories/central/'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.+'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven {
            url 'https://<deployment-address>/content/repositories/central/'
        }
    }
}

Obviously, the url will depend on your server's IP address and configurations.

- Gandharva Kumar

We help companies create loveable apps for iOS, Android and the Web. If you would like to contact us for a consulation, a quote or to take us out for a beer, you can send us an email at pune@leftshift.io

Like this post? Subscribe to our newsletter