Skip to content

Instantly share code, notes, and snippets.

@namuan
Created August 26, 2018 20:18
Show Gist options
  • Save namuan/4ed52efa35512b37541e3d078d62aa4b to your computer and use it in GitHub Desktop.
Save namuan/4ed52efa35512b37541e3d078d62aa4b to your computer and use it in GitHub Desktop.
[Publishing to local Artifactory] #artifactory #maven

Start up Artifactory in a docker instance

docker run -d --name docker-artefactory -v $ARTIFACTORY_HOME/data -v $ARTIFACTORY_HOME/logs -v $ARTIFACTORY_HOME/backup -P docker.bintray.io/jfrog/artifactory-oss:latest

Find the port number using Kitematic and browse to the web address

http://docker-ip:32804/artifactory/webapp/#/home

Setup using password

Abcd1234

No Proxy

Create maven directories

Go to user profile and copy Encrypted Password

User: admin

p: AP8S3m8QMbiRGhMVDuavHgi1

buildscript {
    repositories {
        jcenter()

    }
    dependencies {
        classpath "org.jfrog.buildinfo:build-info-extractor-gradle:4+"
    }
}

dependencies {
    compile("junit:junit:${libs_version_public_junit}")
    compile("org.springframework:spring-web:${libs_version_public_spring_web}")
    compile("com.fasterxml.jackson.core:jackson-databind:${libs_version_jackson_databind}")
    compile("com.github.tomakehurst:wiremock:${libs_version_wiremock}")
    compile("org.slf4j:slf4j-api:${libs_version_slf4j}")
    compile("ch.qos.logback:logback-classic:${libs_version_logback}")
}

test {
    systemProperties System.getProperties()
}

jar.baseName = jar.baseName.toLowerCase()

task tgzTask(type: Tar) {
    into('kong') {
        from 'kong'
    }
    from "${jar.baseName}-0.0.1-1.rockspec"

    destinationDir file('build/tar')
    extension = 'tar.gz'
    compression = Compression.GZIP
}

apply plugin: 'maven-publish'
apply plugin: "com.jfrog.artifactory"

artifactory {
    contextUrl = "http://docker-ip:32804/artifactory"   //The base Artifactory URL if not overridden by the publisher/resolver
    publish {
        repository {
            repoKey = 'libs-release-local'
            username = "johndoe"
            password = "AP8S3m8QMbiRGhMVDuavHgi1"
            maven = false
        }
        defaults {
            publications('mavenZip')
            publishBuildInfo = false
        }
    }
}

// artifactory-publish plugin uses the maven-publish plugin and uploads publications

publishing {
    publications {
        mavenZip(MavenPublication) {
            version = '1.0.2'
            artifact("build/tar/${jar.baseName}.tar.gz", {
                extension = 'tar.gz'
            })
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment