Install Artifactory OSS private maven repository

Munish Chandel | March 12, 2018 at 10:06 PM | 210 views


JFrog’s Artifactory open source project was created to speed up development cycles using binary repositories. It’s the world’s most advanced repository manager, creating a single place for teams to manage all their binary artifacts efficiently.

JFrog Artifactory OSS

Artifactory OSS can be very helpful tool when you want to host your own private maven repository for sharing common code within company premises.

private hosted repository

Installation on Ubuntu 16.04

gpg --keyserver pgpkeys.mit.edu --recv-key 6B219DCCD7639232
gpg -a --export 6B219DCCD7639232 | sudo apt-key add -
sudo apt-get update
sudo dpkg -i jfrog-artifactory-oss-5.8.3.deb
cd /opt/jfrog/artifactory/bin/
sudo ./configure.mysql.sh
Set Proper Permissions in Mysql
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX on artdb.* TO 'artifactory'@'localhost' IDENTIFIED BY 'password';
flush priviledges;
Manage Service for Artifactory
systemctl enable artifactory.service
systemctl start artifactory.service
systemctl stop artifactory.service
Uninstall Artifactory OSS
sudo apt-get remove jfrog-artifactory-oss

Create User, User Group and Permissions

Using Artifactory in your Gradle Project

gradle.properties
artifactory_user=${security.getCurrentUsername()}
artifactory_password=${security.getEncryptedPassword()!"AP9vEVsG9KunZzo6w7P1xwUhxBx"}
artifactory_contextUrl=http://oss.shunyafoundation.com/artifactory
build.gradle [Top Level]
buildscript {
    repositories {
        maven {
            url 'http://oss.shunyafoundation.com/artifactory/libs-release'
            credentials {
                username = "${artifactory_user}"
                password = "${artifactory_password}"
            }
        }

    }
    dependencies {
        //Check for the latest version here: http://plugins.gradle.org/plugin/com.jfrog.artifactory
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}

allprojects {
    apply plugin: "com.jfrog.artifactory"
}

artifactory {
    contextUrl = "${artifactory_contextUrl}"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-snapshot-local'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
    resolve {
        repository {
            repoKey = 'libs-snapshot'
            username = "${artifactory_user}"
            password = "${artifactory_password}"
            maven = true

        }
    }
}

Publishing Artifacts from common module to OSS

A shared library can be published to Artifactory OSS so that the other microservices/projects can start using this versioned library using maven dependency.

We can easily configure an artifact to publish it onto OSS.

apply plugin: "com.jfrog.artifactory"

version = '0.0.1-SNAPSHOT'
group = 'com.shunya'

artifactory {
    contextUrl = "${artifactory_contextUrl}"
    publish {
        repository {
            repoKey = 'libs-snapshot-local'
            username = "${artifactory_username}"
            password = "${artifactory_password}"
            maven = true
        }
        defaults {
            publications ('mavenJava')
        }
    }
}

publishing {
    publications {
        mavenJava(MavenPublication) {
            from components.java
        }
    }
}

Upgrade Artifactory to Latest Version

sudo systemctl stop artifactory.service

wget https://bintray.com/artifact/download/jfrog/artifactory-debs/pool/main/j/jfrog-artifactory-oss-deb/jfrog-artifactory-oss-5.9.0.deb
sudo dpkg -i jfrog-artifactory-oss-5.9.0.deb

sudo systemctl start artifactory.service

Buy DRM Free PDF for Complete Collection of Interview Questions
Generic placeholder image
ebook PDF - Cracking Java Interviews v3.4 by Munish Chandel

240 real Java interview questions on core Java, concurrency, algorithms, design & data structures, spring, hibernate for Investment Bank, Healthcare IT, product and service based companies, Author : Munish Chandel, Price: 250, Type: PDF

Free Email Updates
Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.


Similar Articles:
  1. Basic Unix commands for every programmer
  2. Install Artifactory OSS private maven repository
Facebook Page
Related Topics
Free Email Updates (100+ Subscribers)

Enter your email address to subscribe to this blog and receive notifications of new posts by email.


This website uses cookies to ensure you get the best experience on our website. more info