Android: publish library project to nexus repository manager

Other: How to setup a Private Maven Repository for in-house Android libraries distribution using ARTIFACTORY

I deploy and test on ubuntu 16.04

Install JDK and JRE

sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo apt-get install openjdk-8-jre

Guide to naming conventions on groupId, artifactId and version

* groupId will identify your project uniquely across all projects, so we need to enforce a naming schema. It has to follow the package name rules, what means that has to be at least as a domain name you control, and you can create as many subgroups as you want. Look at More information about package names.
eg. org.apache.maven, org.apache.commons

eg. org.apache.maven, org.apache.maven.plugins, org.apache.maven.reporting

* artifactId is the name of the jar without version. If you created it then you can choose whatever name you want with lowercase letters and no strange symbols. If it’s a third party jar you have to take the name of the jar as it’s distributed.
eg. maven, commons-math

* version if you distribute it then you can choose any typical version with numbers and dots (1.0, 1.1, 1.0.1, …). Don’t use dates as they are usually associated with SNAPSHOT (nightly) builds. If it’s a third party artifact, you have to use their version number whatever it is, and as strange as it can look.
eg. 2.0, 2.0.1, 1.3.1

Download Nexus Repository OSS: https://www.sonatype.com/download-oss-sonatype
Extract

cd <nexus.versionxxx>/bin/
./nexus run

goto: http://localhost:8081
sign in with: admin/admin123

On Client
Publish lib to nexus in project contain library side:

Config JAVA_HOME in ~/.bash_aliases

In the end of build.gradle of library module

Upload to nexus:

./gradlew upload

bash: ./gradlew: Permission denied
-> Fix: chmod +x gradlew

In project using library:
In the top build.gradle file

And using the library normally:

compile ‘com.beesightsoft.caf:rx:2.0.0’
Show your support

Clapping shows how much you appreciated Nhan Cao’s story.