Skip to content

Instantly share code, notes, and snippets.

@squarepegsys
Last active July 5, 2018 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save squarepegsys/acbcdf5ed714f6c0ab1b01360a90687d to your computer and use it in GitHub Desktop.
Save squarepegsys/acbcdf5ed714f6c0ab1b01360a90687d to your computer and use it in GitHub Desktop.
snapshots and gradle
// shamelessly stolen from https://discuss.gradle.org/t/preferred-way-to-publish-snapshots-releases-to-artifactory/20246/2
// all I need to do it set -PreleaseVersion in the build
apply plugin: 'com.jfrog.artifactory'
apply plugin: 'java'
apply plugin: 'maven-publish'
//..
if (project.properties.containsKey("releaseVersion")) {
version = version.split(/-/)[0]
}
project.ext {
artifactoryRepo = project.properties.containsKey("releaseVersion") ? 'libs-release': 'libs-snapshot'
}
//...
publishing.publications {
mavenJava(MavenPublication) {
from components.java
}
}
artifactory {
contextUrl = "https://some.artifactory/artifactory/"
publish {
repository {
repoKey = artifactoryRepo
}
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('mavenJava')
publishArtifacts = true
// Publish generated POM files to Artifactory (true by default)
publishPom = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment