1. Introduction
Initially generated by using generator-jvm yeoman generator (kotlin-parent-multi-project)
2. Implementation
2.1. artifactory-gradle-example
bootstrap artifactory (docker)
docker run --name artifactory -d -p 80:8081 -v $(pwd)/artifactory:/var/opt/jfrog/artifactory docker.bintray.io/jfrog/artifactory-oss:6.1.0
follow wizard to setup artifactory
# create gradle-defaul repository: 'gradle-releases'
configure gradle project properties
file:
build.gradleplugins {
id 'com.jfrog.artifactory' version '4.7.5' apply false
// ...
}
apply from: "$projectDir/gradle/artifactory.gradle"
file:
gradle/artifactory.gradleapply plugin: 'java'
project.javadoc.failOnError = false
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
}
artifacts {
}
apply plugin: 'maven-publish'
publishing {
publications {
mavenJava(MavenPublication) { publication ->
afterEvaluate {
project.shadow.component(publication)
artifact sourcesJar
artifact javadocJar
//artifactId = jar.baseName
pom {
name = project.name
description = project.description
url = "https://github.com/daggerok/$project.name" as String
licenses {
license {
name = 'MIT License'
url = "https://github.com/daggerok/${project.name}/blob/master/LICENSE" as String
}
}
developers {
developer {
id = 'daggerok'
name = 'Maksim Kostromin'
email = 'daggerok@gmail.com'
}
}
scm {
connection = "scm:git:git://github.com/daggeropk/${project.name}.git" as String
developerConnection = "scm:git:ssh://github.com/daggeropk/${project.name}.git" as String
url = "http://github.com/daggeropk/$project.name" as String
}
}
}
}
}
}
apply plugin: 'com.jfrog.artifactory'
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'gradle-releases'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publishBuildInfo = false
publishIvy = false
publishPom = true
publishConfigs('archives')
//doesn't work?
//publishArtifacts = true
publications('mavenJava')
publishArtifacts = true
properties = [
'ololo': 'trololo',
'Deployed By': System.properties['user.name'],
]
}
}
resolve {
repository {
repoKey = 'gradle-release'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
clientConfig.includeEnvVars = true
clientConfig.envVarsExcludePatterns = '*pwd*,*password*,*PWD*,*PASSWORD*,*Password,*secret*,*SECRET*,*key*,*KEY*,sonar.login'
clientConfig.info.buildName = project.name
clientConfig.info.buildNumber = version
}
publish artifacts to artifactory
./gradlew assemble artifactoryPublish
2.2. artifactory-maven-repo-gradle-example
bootstrap artifactory (docker)
docker run --name artifactory -d -p 80:8081 -v $(pwd)/artifactory:/var/opt/jfrog/artifactory docker.bintray.io/jfrog/artifactory-oss:6.1.0
configure artifactory
skip password configuration
skip proxy configuration
create maven default repository
we interested in 'libs-release-local' and 'libs-snapshot-local'
configure gradle project properties
artifactory_user=admin
#artifactory_password=password
artifactory_password=AP9nMJd5Cyv1fzHk9BBHomJKUEe
artifactory_contextUrl=http://127.0.0.1/artifactory
file:
build.gradleplugins {
id 'com.jfrog.artifactory' version '4.7.5' apply false
// ...
}
apply from: "$projectDir/gradle/artifactory.gradle"
file:
gradle/artifactory.gradleapply plugin: 'java'
project.javadoc.failOnError = false
task sourcesJar(type: Jar) {
from sourceSets.main.allJava
classifier 'sources'
}
task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
}
apply plugin: 'maven-publish'
distributions {
main {
contents {
from('build/libs') {
include '**/*.*'
}
from('build/install') {
include '**/*.*'
}
into('.')
}
}
}
distZip.dependsOn(installDist, jar)
publishing {
publications {
mavenJava(MavenPublication) { publication ->
afterEvaluate {
project.shadow.component(publication)
artifact sourcesJar
artifact javadocJar
//artifactId = jar.baseName
//artifact makeZip
pom {
name = project.name
description = project.description
url = "https://github.com/daggerok/$project.name" as String
licenses {
license {
name = 'MIT License'
url = "https://github.com/daggerok/${project.name}/blob/master/LICENSE" as String
}
}
developers {
developer {
id = 'daggerok'
name = 'Maksim Kostromin'
email = 'daggerok@gmail.com'
}
}
scm {
connection = "scm:git:git://github.com/daggeropk/${project.name}.git" as String
developerConnection = "scm:git:ssh://github.com/daggeropk/${project.name}.git" as String
url = "http://github.com/daggeropk/$project.name" as String
}
}
}
}
}
}
apply plugin: 'com.jfrog.artifactory'
artifactory {
contextUrl = "${artifactory_contextUrl}" //The base Artifactory URL if not overridden by the publisher/resolver
publish {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
defaults {
publishBuildInfo = false
publishIvy = false
publishPom = true
publishConfigs('archives')
//doesn't work?
//publishArtifacts = true
publications('mavenJava')
publishArtifacts = true
properties = [
'ololo': 'trololo',
'Deployed By': System.properties['user.name'],
]
}
}
resolve {
repository {
repoKey = 'libs-release-local'
username = "${artifactory_user}"
password = "${artifactory_password}"
maven = true
}
}
clientConfig.includeEnvVars = true
clientConfig.envVarsExcludePatterns = '*pwd*,*password*,*PWD*,*PASSWORD*,*Password,*secret*,*SECRET*,*key*,*KEY*,sonar.login'
clientConfig.info.buildName = project.name
clientConfig.info.buildNumber = version
}
publish artifacts to artifactory
./gradlew assemble artifactoryPublish