Skip to content

Commit

Permalink
KAFKA-2199 Make signing artifacts optional and disabled by
Browse files Browse the repository at this point in the history
 default for SNAPSHOTs and allow remote Maven repository configuration from
 the command line.
  • Loading branch information
ewencp authored and jkreps committed May 29, 2015
1 parent 3836c57 commit 3d8494b
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 28 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -93,6 +93,9 @@ Please note for this to work you should create/update `~/.gradle/gradle.properti
signing.password=
signing.secretKeyRingFile=

### Publishing the jars without signing to a local repository ###
./gradlew -Dorg.gradle.project.skipSigning=true -Dorg.gradle.project.mavenUrl=file://path/to/repo uploadArchivesAll

### Building the test jar ###
./gradlew testJar

Expand Down
50 changes: 26 additions & 24 deletions build.gradle
Expand Up @@ -31,10 +31,13 @@ allprojects {

ext {
gradleVersion = "2.4"
}

def isVerificationRequired(project) {
project.gradle.startParameter.taskNames.any { it.contains("upload") }
skipSigning = project.hasProperty('skipSigning') && skipSigning.toBoolean()
shouldSign = !skipSigning && !version.endsWith("SNAPSHOT")

mavenUrl = project.hasProperty('mavenUrl') ? project.mavenUrl : ''
mavenUsername = project.hasProperty('mavenUsername') ? project.mavenUsername : ''
mavenPassword = project.hasProperty('mavenPassword') ? project.mavenPassword : ''
}

apply from: file('wrapper.gradle')
Expand All @@ -54,27 +57,26 @@ subprojects {
uploadArchives {
repositories {
signing {
if (isVerificationRequired(project)) {
sign configurations.archives

// To test locally, replace mavenUrl in ~/.gradle/gradle.properties to file://localhost/tmp/myRepo/
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "${mavenUrl}") {
authentication(userName: "${mavenUsername}", password: "${mavenPassword}")
}
afterEvaluate {
pom.artifactId = "${archivesBaseName}"
pom.project {
name 'Apache Kafka'
packaging 'jar'
url 'http://kafka.apache.org'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
required { shouldSign }
sign configurations.archives

// To test locally, replace mavenUrl in ~/.gradle/gradle.properties to file://localhost/tmp/myRepo/
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "${mavenUrl}") {
authentication(userName: "${mavenUsername}", password: "${mavenPassword}")
}
afterEvaluate {
pom.artifactId = "${archivesBaseName}"
pom.project {
name 'Apache Kafka'
packaging 'jar'
url 'http://kafka.apache.org'
licenses {
license {
name 'The Apache Software License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions gradle.properties
Expand Up @@ -18,7 +18,3 @@ version=0.8.3-SNAPSHOT
scalaVersion=2.10.5
task=build
org.gradle.jvmargs=-XX:MaxPermSize=512m -Xmx1024m

mavenUrl=
mavenUsername=
mavenPassword=

0 comments on commit 3d8494b

Please sign in to comment.