Last active
August 27, 2015 21:59
-
-
Save sephiroth74/381981d26cd00fc28812 to your computer and use it in GitHub Desktop.
publish artifact to local maven repository
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
apply plugin: 'maven' | |
apply plugin: 'signing' | |
def isReleaseBuild() { | |
return VERSION_NAME.contains("SNAPSHOT") == false | |
} | |
def getReleaseRepositoryUrl() { | |
return "file:///${project.rootDir}/mvn-repo/release/" | |
} | |
def getSnapshotRepositoryUrl() { | |
return "file:///${project.rootDir}/mvn-repo/snapshot/" | |
} | |
afterEvaluate { project -> | |
uploadArchives { | |
repositories { | |
mavenDeployer { | |
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) } | |
pom.groupId = GROUP | |
pom.artifactId = POM_ARTIFACT_ID | |
pom.version = VERSION_NAME | |
repository(url: getReleaseRepositoryUrl()) { | |
} | |
snapshotRepository(url: getSnapshotRepositoryUrl()) { | |
} | |
pom.project { | |
name POM_NAME | |
packaging POM_PACKAGING | |
description POM_DESCRIPTION | |
licenses { | |
license { | |
name POM_LICENCE_NAME | |
url POM_LICENCE_URL | |
distribution POM_LICENCE_DIST | |
} | |
} | |
developers { | |
developer { | |
id POM_DEVELOPER_ID | |
name POM_DEVELOPER_NAME | |
} | |
} | |
} | |
} | |
} | |
} | |
signing { | |
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } | |
sign configurations.archives | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment