summaryrefslogtreecommitdiffstats
path: root/gradle/maven.gradle
diff options
context:
space:
mode:
authorShevek <[email protected]>2013-12-27 05:49:13 -0800
committerShevek <[email protected]>2013-12-27 05:49:13 -0800
commitbdc6c852f418c3e042aa41469d84544e5f60a526 (patch)
tree7866346f0fa48ad46a6a427d016dd4b83451dbbe /gradle/maven.gradle
parent39264fd6d2a6646e49f83b5b2b3512c1663a1c9b (diff)
Version bump to 1.4.0-SNAPSHOT.
Rewrite build system to use gradle. Clean up source for the new generation.
Diffstat (limited to 'gradle/maven.gradle')
-rw-r--r--gradle/maven.gradle69
1 files changed, 69 insertions, 0 deletions
diff --git a/gradle/maven.gradle b/gradle/maven.gradle
new file mode 100644
index 0000000..0513719
--- /dev/null
+++ b/gradle/maven.gradle
@@ -0,0 +1,69 @@
+// Maven side of things
+apply plugin: 'maven' // Java plugin has to have been already applied for the conf2scope mappings to work
+apply plugin: 'signing'
+
+signing {
+ required { gradle.taskGraph.hasTask(uploadMavenCentral) }
+ sign configurations.archives
+}
+
+/**
+ * Publishing to Maven Central example provided from http://jedicoder.blogspot.com/2011/11/automated-gradle-project-deployment-to.html
+ * artifactory will execute uploadArchives to force generation of ivy.xml, and we don't want that to trigger an upload to maven
+ * central, so using custom upload task.
+ */
+task uploadMavenCentral(type:Upload, dependsOn: signArchives) {
+ configuration = configurations.archives
+ onlyIf { ['release', 'snapshot'].contains(project.status) }
+ repositories.mavenDeployer {
+ beforeDeployment { signing.signPom(it) }
+
+ // To test deployment locally, use the following instead of oss.sonatype.org
+ //repository(url: "file://localhost/${rootProject.rootDir}/repo")
+
+ def sonatypeUsername = rootProject.hasProperty('sonatypeUsername')?rootProject.sonatypeUsername:''
+ def sonatypePassword = rootProject.hasProperty('sonatypePassword')?rootProject.sonatypePassword:''
+
+ repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2') {
+ authentication(userName: sonatypeUsername, password: sonatypePassword)
+ }
+
+ snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
+ authentication(userName: sonatypeUsername, password: sonatypePassword)
+ }
+
+ // Prevent datastamp from being appending to artifacts during deployment
+ uniqueVersion = false
+
+ // Closure to configure all the POM with extra info, common to all projects
+ pom.project {
+ name "${project.name}"
+ description "Java C Preprocessor"
+ developers {
+ developer {
+ id 'shevek'
+ name 'Shevek'
+ }
+ }
+ licenses {
+ license {
+ name 'The Apache Software License, Version 2.0'
+ url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+ distribution 'repo'
+ }
+ }
+ url "https://github.com/shevek/${rootProject.githubProjectName}"
+ scm {
+ connection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ url "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ developerConnection "scm:git:[email protected]:shevek/${rootProject.githubProjectName}.git"
+ }
+ issueManagement {
+ system 'github'
+ url "https://github.com/shevek/${rootProject.githubProjectName}/issues"
+ }
+ }
+ }
+}
+