Skip to content

Instantly share code, notes, and snippets.

@yogan
Last active July 1, 2019 14:59
Show Gist options
  • Save yogan/ff1d0ef968965bebb203f7adbf3188bb to your computer and use it in GitHub Desktop.
Save yogan/ff1d0ef968965bebb203f7adbf3188bb to your computer and use it in GitHub Desktop.
pipeline {
agent any
// tools, global options, etc.
stages {
// build, test, etc.
stage("Publish CLI delivery to Nexus") {
steps {
dir("cli") {
// publish using maven coordinates from pom.xml
// needs Jenkins plugin: Pipeline Utility Steps
// https://support.sonatype.com/hc/en-us/articles/115009108987-Jenkins-Publish-Using-Maven-Coordinates-from-the-pom-xml
script {
def pom = readMavenPom file: 'pom.xml'
nexusPublisher nexusInstanceId: 'nexus', \
nexusRepositoryId: 'FIXME: INSERT-GROUP-NAME-HERE', \
packages: [[$class: 'MavenPackage', \
mavenAssetList: [[classifier: '', extension: '', \
filePath: "target/${pom.artifactId}-${pom.version}.${pom.packaging}"]], \
mavenCoordinate: [artifactId: "${pom.artifactId}", \
groupId: "${pom.groupId}", \
packaging: "${pom.packaging}", \
version: "${pom.version}"]]]
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment