Skip to content

Commit

Permalink
Merge pull request #162 from stchar/feature/artifactory
Browse files Browse the repository at this point in the history
Update to use repo.jenkinci.org artifactory
  • Loading branch information
stchar authored Dec 4, 2019
2 parents b9bf2e3 + 5ee10f8 commit 9cbce6c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ jdk:
- openjdk8
install: true
script:
./gradlew verify -x sign
./gradlew verify
cache:
directories:
- $HOME/.gradle/caches/
Expand Down
130 changes: 64 additions & 66 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import com.lesfurets.gradle.*

plugins {
id "io.codearte.nexus-staging" version "0.8.0"
id "com.jfrog.artifactory" version "4.11.0"
id 'groovy'
id 'maven-publish'
id 'java'
id 'jacoco'
}

apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply plugin: 'jacoco'

repositories {
mavenCentral()
mavenCentral()
jcenter()
}

group = "com.lesfurets"
Expand Down Expand Up @@ -60,14 +60,6 @@ task sourcesJar(type: Jar) {
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

// Copy the resolved grapes configuration to a maven2 like directory structure (no transitive dependencies)
task copyGrapesDependencies(type: CopyDependenciesToMavenTreeTask) {
configuration = configurations.grape
Expand All @@ -94,85 +86,91 @@ jacocoTestReport {
}
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

def repo = project.hasProperty('repository') ?
project.repository :
"https://oss.sonatype.org/service/local/staging/deploy/maven2/"
repository(url: repo) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

def snapRepo = project.hasProperty('snapshotRepository') ?
project.snapshotRepository :
"https://oss.sonatype.org/content/repositories/snapshots/"
snapshotRepository(url: snapRepo) {
authentication(userName: ossrhUsername, password: ossrhPassword)
}

pom.project {
name "$project.group:$project.archivesBaseName"
packaging 'jar'
description 'Jenkins Pipeline Unit testing framework'
url 'https://github.com/lesfurets/JenkinsPipelineUnit'
publishing {
publications {
maven(MavenPublication) {
from components.java
artifact tasks.sourcesJar
artifact tasks.javadocJar
pom {
artifactId = "$project.archivesBaseName"
packaging = 'jar'
description = 'Jenkins Pipeline Unit testing framework'
url = 'https://github.com/jenkinsci/JenkinsPipelineUnit'

scm {
url 'https://github.com/lesfurets/JenkinsPipelineUnit'
connection 'scm:git:git://github.com/lesfurets/JenkinsPipelineUnit.git'
developerConnection 'scm:git:[email protected]/lesfurets/JenkinsPipelineUnit.git'
url = 'https://github.com/jenkinsci/JenkinsPipelineUnit'
connection = 'scm:git:git://github.com/jenkinsci/JenkinsPipelineUnit.git'
developerConnection = 'scm:git:[email protected]/jenkinsci/JenkinsPipelineUnit.git'
}

licenses {
license {
name 'MIT License'
url 'http://www.opensource.org/licenses/mit-license.php'
distribution 'repo'
name = 'MIT License'
url = 'http://www.opensource.org/licenses/mit-license.php'
distribution = 'repo'
}
}

developers {
developer {
id 'ozangunalp'
name 'Ozan Gunalp'
email '[email protected]'
url 'https://github.com/ozangunalp'
organization 'lesfurets.com'
organizationUrl 'https://github.com/lesfurets'
id = 'ozangunalp'
name = 'Ozan Gunalp'
email = '[email protected]'
url = 'https://github.com/ozangunalp'
organization = 'lesfurets.com'
organizationUrl = 'https://github.com/lesfurets'
}
developer {
id 'EQuincerot'
name 'Emmanuel Quincerot'
url 'https://github.com/EQuincerot'
organization 'lesfurets.com'
organizationUrl 'https://github.com/lesfurets'
id = 'EQuincerot'
name = 'Emmanuel Quincerot'
url = 'https://github.com/EQuincerot'
organization = 'lesfurets.com'
organizationUrl = 'https://github.com/lesfurets'
}
developer {
name 'Thomas du Boÿs'
url 'https://github.com/Skool'
id 'Skool'
organization 'lesfurets.com'
organizationUrl 'https://github.com/lesfurets'
name = 'Thomas du Boÿs'
url = 'https://github.com/Skool'
id = 'Skool'
organization = 'lesfurets.com'
organizationUrl = 'https://github.com/lesfurets'
}
}
}
}
}
}

nexusStaging {
delayBetweenRetriesInMillis = 5000
artifactory {
contextUrl = 'https://repo.jenkins-ci.org'
publish {
repository {
repoKey = project.version.toString().endsWith('-SNAPSHOT') ? 'snapshots' : 'releases'
username = "${artifactory_user}" // The publisher user name
password = "${artifactory_password}" // The publisher password
}
defaults {
// Reference to Gradle publications defined in the build script.
// This is how we tell the Artifactory Plugin which artifacts should be
// published to Artifactory.
publications('maven')
publishArtifacts = true
// Properties to be attached to the published artifacts.
properties = ['qa.level': 'basic', 'dev.team' : 'core']
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}

// Deploy tasks
closeAndReleaseRepository.mustRunAfter(uploadArchives)
closeRepository.enabled = !project.version.toString().endsWith('-SNAPSHOT')
releaseRepository.enabled = !project.version.toString().endsWith('-SNAPSHOT')
//closeAndReleaseRepository.mustRunAfter(uploadArtifacts)
//closeRepository.enabled = !project.version.toString().endsWith('-SNAPSHOT')
//releaseRepository.enabled = !project.version.toString().endsWith('-SNAPSHOT')

task verify(dependsOn: build)
task deploy(dependsOn: [build, uploadArchives, closeAndReleaseRepository])
task deploy(dependsOn: [build, artifactoryDeploy])

// Release commits and tag
task writeVersion(type: SetVersionTask)
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# dummy properties
ossrhUsername=deployment
ossrhPassword=deployment123
artifactory_user=deployment
artifactory_password=deployment123
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip

0 comments on commit 9cbce6c

Please sign in to comment.