Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

complete setup for maven publishing with gradle

  • Loading branch information...
commit 5a9ae09f2ad21140e1b4c30c17de203a8ae436ca 1 parent 6dec22f
@jzillmann jzillmann authored
Showing with 72 additions and 7 deletions.
  1. +20 −2 README.markdown
  2. +52 −5 build.gradle
View
22 README.markdown
@@ -6,7 +6,25 @@ ZkClient: a zookeeper client, that makes life a little easier.
Build ZkClient from sources:
-=====
+---------------
+ git clone https://github.com/sgroschupf/zkclient.git
-+ ./gradlew test (see available build targets by executing './gradlew tasks' )
++ ./gradlew test _(run the test suite)_
++ ./gradlew jars _(build the jars)_
++ (see available build targets by executing './gradlew tasks' )
+
+
+Howto release ZkClient as maven artifact
+---------------
+- sonatype repository is already configured: https://issues.sonatype.org/browse/OSSRH-4783
+- generate gpg key and publish it to _hkp://pool.sks-keyservers.net_ (https://docs.sonatype.org/display/Repository/How+To+Generate+PGP+Signatures+With+Maven may be of help)
+- tell gradle about the gpg key and sonatype credentials, e.g. through ~/.gradle/gradle.properties:
+ sonatypeUsername=<yourSonatypeUser>
+ sonatypePassword=<yourSonatypePassword>
+ signing.keyId=<yourKeyId>
+ signing.password=<yourKeyPassphrase>
+ signing.secretKeyRingFile=/Users/<username>/.gnupg/secring.gpg
+- execute _gradle uploadArchives_ to uploaded the signed artifacts to the sonatype repository
+- go to https://oss.sonatype.org/index.html#stagingRepositories and close the repository
+- check the artifacts and if everything is ok, release the repository (on the same page)
+- syncing to central maven repository will then be activated (might take around 2h)
View
57 build.gradle
@@ -1,6 +1,8 @@
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
+apply plugin: 'signing'
+apply plugin: 'project-reports'
group = 'com.101tec'
version = '0.2'
@@ -19,10 +21,22 @@ jar {
repositories {
flatDir(dirs: 'lib')
// mavenCentral()
+ // maven {
+ // url "https://oss.sonatype.org/content/repositories/com101tec-553"
+ //}
}
dependencies {
- compile 'org.apache.zookeeper:zookeeper:3.3.1'
- compile 'log4j:log4j:1.2.14'
+ //compile 'com.101tec:zkclient:0.2'
+ compile ('log4j:log4j:1.2.14') {
+ exclude group: "com.sun.jdmk", module: "jmxtools"
+ exclude group: "com.sun.jmx", module: "jmxri"
+ exclude group: "javax.jms", module: "jms"
+ }
+ compile ('org.apache.zookeeper:zookeeper:3.3.1') {
+ exclude group: "com.sun.jdmk", module: "jmxtools"
+ exclude group: "com.sun.jmx", module: "jmxri"
+ exclude group: "javax.jms", module: "jms"
+ }
testCompile 'junit:junit:4.7'
testCompile 'commons-io:commons-io:1.4'
testCompile 'org.mockito:mockito-core:1.8.0'
@@ -53,7 +67,12 @@ task jars(dependsOn: ['jar','sourceJar'], description: 'Build jar & source jar')
//--------------------
// Eclipse Setup
//--------------------
-eclipseClasspath { defaultOutputDir = new File(project.getProjectDir().getAbsolutePath() + "/build-eclipse"); }
+eclipse {
+ classpath {
+ defaultOutputDir = file('build-eclipse')
+ }
+}
+
task eclipseJdtPrepare(type: Copy) {
from rootProject.file('src/build/eclipse/org.eclipse.jdt.core.prefs')
into project.file('.settings/')
@@ -65,11 +84,23 @@ tasks["eclipseJdt"].dependsOn(eclipseJdtPrepare)
// Maven Artifact publishing
//--------------------
+signing {
+ required { gradle.taskGraph.hasTask("uploadArchives") }
+ sign configurations.archives
+}
+
+
uploadArchives {
+
repositories.mavenDeployer {
- repository(url: "file:///tmp/mavenRepo")
+ //repository(url: "file:///tmp/mavenRepo")
+ repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
+ authentication(userName: sonatypeUsername, password: sonatypePassword)
+ }
+ beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
pom.project {
name 'ZkClient'
+ packaging 'jar'
description 'A zookeeper client, that makes life a little easier.'
url 'https://github.com/sgroschupf/zkclient'
licenses {
@@ -81,7 +112,22 @@ uploadArchives {
}
scm {
url 'https://github.com/sgroschupf/zkclient'
- connection 'https://github.com/sgroschupf/zkclient.git'
+ connection 'scm:git:git://github.com/sgroschupf/zkclient.git'
+ developerConnection 'scm:git:https://github.com/sgroschupf/zkclient.git'
+ }
+ developers {
+ developer {
+ id 'sgroschupf'
+ name 'Stefan Groshupf'
+ }
+ developer {
+ id 'pvoss'
+ name 'Peter Voss'
+ }
+ developer {
+ id 'jzillmann'
+ name 'Johannes Zillmann'
+ }
}
}
}
@@ -94,3 +140,4 @@ uploadArchives {
task wrapper(type: Wrapper, description: 'Generate the Gradle Wrapper') {
gradleVersion = '1.3'
}
+
Please sign in to comment.
Something went wrong with that request. Please try again.