Last active
July 5, 2018 15:36
-
-
Save squarepegsys/acbcdf5ed714f6c0ab1b01360a90687d to your computer and use it in GitHub Desktop.
snapshots and gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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