You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ab...@apache.org on 2016/02/08 18:03:57 UTC

[42/50] [abbrv] incubator-geode git commit: GEODE-781: Update maven publishing to include signatures

GEODE-781: Update maven publishing to include signatures

The maven-publish plugin does not grok signature nor sign pom
files.  These are needed for publishing release versions on Maven
Central.  Switching over to the nexus plugin simplified signing,
generation of javadoc / sources jars, and publishing.

To publish to the local maven repository (~/.m2/repository):
  gradle install

To publish to the snapshot / release repositories:
  gradle uploadArtifacts

Signatures will only be created if the following properties are set
in ~/.gradle.properties:
  signing.keyId
  signing.secretKeyRingFile
  signing.password

To upload the artifacts to Maven, you will need to set the following
properties in ~/.gradle/gradle.properties:
  nexusUsername
  nexusPassword


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/e9bf2535
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/e9bf2535
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/e9bf2535

Branch: refs/heads/master
Commit: e9bf2535fcd635bc183123138e1a8b28501f4374
Parents: e2c35d7
Author: Anthony Baker <ab...@apache.org>
Authored: Thu Jan 14 14:47:59 2016 -0800
Committer: Anthony Baker <ab...@apache.org>
Committed: Sat Jan 16 09:35:46 2016 -0800

----------------------------------------------------------------------
 build.gradle                          |  75 +++++++++++-------
 gemfire-assembly/build.gradle         | 119 +++++------------------------
 gemfire-core/build.gradle             |   4 -
 gemfire-web-api/build.gradle          |   4 -
 gemfire-web/build.gradle              |   4 -
 gradle/dependency-versions.properties |   3 -
 6 files changed, 68 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index f42f786..2322120 100755
--- a/build.gradle
+++ b/build.gradle
@@ -17,13 +17,14 @@
 
 buildscript {
   repositories {
-    maven {
-      url "https://plugins.gradle.org/m2/"
-    }
+    maven { url "https://plugins.gradle.org/m2/" }
   }
+
   dependencies {
     classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.0"
     classpath "org.ajoberstar:gradle-git:1.3.2"
+    classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
+    classpath 'org.hibernate.build.gradle:gradle-maven-publish-auth:2.0.1'
   }
 }
 
@@ -110,17 +111,6 @@ gradle.taskGraph.whenReady({ graph ->
 
 subprojects {
   apply plugin: 'java'
-  apply plugin: 'signing'
-
-  // set these properties in ~/.gradle/gradle.properties file: 
-  // signing.keyId
-  // signing.password
-  // signing.secretKeyRingFile
-  if (isReleaseVersion) {
-    signing {
-      sign configurations.archives
-    }
-  }
 
   // apply compiler options
   gradle.taskGraph.whenReady( { graph ->
@@ -309,20 +299,8 @@ subprojects {
     classifier 'test'
   }
 
-  task sourcesJar(type: Jar, dependsOn: classes) {
-    classifier = 'sources'
-    from sourceSets.main.allSource
-  }
-
-  task javadocJar(type: Jar, dependsOn: javadoc) {
-    description 'Assembles a jar archive of javadocs.'
-    from javadoc.destinationDir
-    classifier = 'javadoc'
-  }
-
   artifacts {
     testOutput jarTest
-    archives sourcesJar, javadocJar
   }
 
   sourceSets {
@@ -495,6 +473,51 @@ subprojects {
     }
   })
 
+  // publishing configuration
+  apply plugin: 'com.bmuschko.nexus'
+  apply plugin: 'maven-publish-auth'
+  
+  extraArchive {
+    sources = true
+    javadoc = true
+    tests = false
+  }
+
+  nexus {
+    sign = true
+    repositoryUrl = 'https://repository.apache.org/service/local/staging/deploy/maven2'
+    snapshotRepositoryUrl = 'https://repository.apache.org/content/repositories/snapshots'
+  }
+  
+  modifyPom {
+    project {
+      name 'Apache Geode (incubating)'
+      description 'Apache Geode (incubating) provides a database-like consistency model, reliable transaction processing and a shared-nothing architecture to maintain very low latency performance with high concurrency processing'
+      url 'http://geode.incubator.apache.org'
+
+      scm {
+        url 'https://git-wip-us.apache.org/repos/asf?p=incubator-geode.git;a=tree'
+        connection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
+        developerConnection 'scm:https://git-wip-us.apache.org/repos/asf/incubator-geode.git'
+      }
+
+      licenses {
+        license {
+          name 'The Apache Software License, Version 2.0'
+          url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+        }
+      }
+
+      repositories {
+        repository {
+          id 'libs-release'
+          name 'Spring Maven libs-release Repository'
+          url 'http://repo.spring.io/libs-release'
+        }
+      }
+    }
+  }
+
   // Make precheckin task run all validation tests for checking in code.
   task precheckin (dependsOn: [ build, integrationTest, distributedTest ]) {
     description 'Run this task before checking in code to validate changes. This task combines the following tasks: build, integrationTest, and distributedTest'

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/gemfire-assembly/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-assembly/build.gradle b/gemfire-assembly/build.gradle
index a3f26a9..5930f13 100755
--- a/gemfire-assembly/build.gradle
+++ b/gemfire-assembly/build.gradle
@@ -16,27 +16,27 @@
  */
 import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
 
-buildscript {
-    repositories {
-        mavenCentral()
-    }
-    dependencies {
-        classpath group: 'org.hibernate.build.gradle', name: 'gradle-maven-publish-auth', version: project.'gradle-maven-publish-auth.version'
-    }
-}
 
 apply plugin: 'distribution'
-apply plugin: 'maven-publish'
-apply plugin: 'maven-publish-auth'
 
 jar.enabled = false
+extraArchive {
+  sources = false
+  javadoc = false
+  tests = false
+}
 
-configurations {
-  archives
+// We are not publishing anything from this project into maven and using two distributions seems
+// to break the nexus plugin.  So we delete the nexus tasks but we have to replace the upload task
+// with an empty task of the same name...argh.
+afterEvaluate {
+  tasks.remove(install)
+  tasks.remove(uploadArchives)
+  task uploadArchives << { }
 }
 
-// gradle doesn't automatically remove the jar artifact even though we disabled it
-// this causes the signing plugin to fail
+// Gradle doesn't automatically remove the jar artifact even though we disabled it
+// this causes publishing to fail.  So we nuke all the disabled artifacts from all configurations.
 configurations.all {
   artifacts.removeAll artifacts.findAll { it instanceof ArchivePublishArtifact && !it.archiveTask.enabled }
 }
@@ -191,13 +191,6 @@ gradle.taskGraph.whenReady( { graph ->
     archive.doLast {
       ant.checksum file:"${archive.archivePath}", algorithm:"md5"
       ant.checksum file:"${archive.archivePath}", algorithm:"sha-256"
-
-      if (isReleaseVersion) {      
-        signing {
-          required { isReleaseVersion }
-          sign archive.archivePath
-        }
-      }
     }
   }
 })
@@ -263,12 +256,15 @@ distributions {
           include 'spring-data-gemfire-*'
         }
         from project(":gemfire-core").configurations.archives.allArtifacts.files
-
+        from project(":gemfire-core").webJar
+        from project(":gemfire-core").raJar
+        from project(":gemfire-core").jcaJar
+        
         from project(":gemfire-lucene").configurations.runtime
         from project(":gemfire-lucene").configurations.archives.allArtifacts.files
 
         // include this jar        
-        from project(":gemfire-web-api").jar.outputs.files.getFiles()
+        from project(":gemfire-web-api").jar
         
         // dependency jars
         from depsJar
@@ -287,79 +283,6 @@ distributions {
   }
 }
 
-
-// Repos to be added to POMs
-def springReleaseRepo = [ id:'spring-release', name:'Spring Maven RELEASE Repository', url:'https://repo.spring.io/release' ]
-def springMilestoneRepo = [ id:'spring-milestone', name:'Spring Maven MILESTONE Repository', url:'https://repo.spring.io/milestone' ]
-def springSnapshotRepo = [ id:'spring-snapshot', name:'Spring Maven SNAPSHOT Repository', url:'https://repo.spring.io/snapshot' ]
-def springLibsReleaseRepo = [ id:'libs-release', name:'Spring Maven libs-release Repository', url:'http://repo.spring.io/libs-release' ]
-def springExtReleaseLocalRepo = [ id:'ext-release-local', name:'Spring Maven ext-release-local Repository', url:'http://repo.spring.io/ext-release-local' ]
-
-def MavenRepos = [ springReleaseRepo, springSnapshotRepo, springLibsReleaseRepo, springExtReleaseLocalRepo ]
-
-// Jars to be published via Maven
-def commonJar = [publicationName:'commonJar', project:project(":gemfire-common").name]
-def coreJar = [publicationName:'coreJar', project:project(":gemfire-core").name]
-def jsonJar = [publicationName:'jsonJar', project:project(":gemfire-json").name]
-def joptsimpleJar = [publicationName:'joptsimpleJar', project:project(":gemfire-joptsimple").name]
-def luceneJar = [publicationName:'luceneJar', project:project(":gemfire-lucene").name]
-def MavenJars = [ coreJar, jsonJar, joptsimpleJar, commonJar, luceneJar ]
-
-afterEvaluate {
-  publishing {
-    publications {
-      MavenJars.each {
-        def publicationName = it.publicationName
-        def projectName = it.project
-        "$publicationName"(MavenPublication) {
-          artifactId projectName
-          artifact project(':' + projectName).jar
-          pom.withXml {
-            def repositoriesNode = asNode().appendNode('repositories')
-            MavenRepos.each {
-              def repositoryNode = repositoriesNode.appendNode('repository')
-              repositoryNode.appendNode('id', it.id)
-              repositoryNode.appendNode('name', it.name)
-              repositoryNode.appendNode('url', it.url)
-            }
-            def dependenciesNode = asNode().appendNode('dependencies')
-            //Iterate over the runtime dependencies
-            project(':' + projectName).configurations.runtime.allDependencies.each {
-              def dependencyNode = dependenciesNode.appendNode('dependency')
-              dependencyNode.appendNode('groupId', it.group)
-              dependencyNode.appendNode('artifactId', it.name)
-              dependencyNode.appendNode('version', it.version)
-            }
-          }
-        }
-      }
-    }
-  }
-
-  // The following is typically defined in a root ASF pom: org.apache:apache
-  // If anything breaks around publishing check that we're still synchronized
-  // with whatever Maven repo definitions are there. Pay special attention to
-  // the names of the repositories -- they need to be spelled exactly like
-  // the ones defined in root ASF pom
-  publishing {
-    repositories {
-      if (!isReleaseVersion) {
-        // Apache Development Snapshot Repository
-        maven {
-          name "apache.snapshots.https"
-          url "https://repository.apache.org/content/repositories/snapshots"
-        }
-      } else {
-        // Apache Release Distribution Repository
-        maven {
-          name "apache.releases.https"
-          url "https://repository.apache.org/service/local/staging/deploy/maven2"
-        }
-      }
-    }
-  } 
-}
-
 // Create a configuration closure to configure test targets with the install directory
 def dependOnInstalledProduct = {
   dependsOn installDist
@@ -371,9 +294,5 @@ def dependOnInstalledProduct = {
 test dependOnInstalledProduct
 distributedTest dependOnInstalledProduct
 
-artifacts {
-  archives depsJar, gfshDepsJar
-}
-
 // Make build final task to generate all test and product resources
 build.dependsOn installDist

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/gemfire-core/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-core/build.gradle b/gemfire-core/build.gradle
index 3e3c19b..041dc07 100755
--- a/gemfire-core/build.gradle
+++ b/gemfire-core/build.gradle
@@ -196,10 +196,6 @@ task jcaJar (type: Jar, dependsOn: raJar) {
   from raJar.archivePath
 }
 
-artifacts {
-  archives webJar, raJar, jcaJar
-}
-
 configurations {
   classesOutput {
     extendsFrom compile

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/gemfire-web-api/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-web-api/build.gradle b/gemfire-web-api/build.gradle
index 7c35ecd..940fddd 100755
--- a/gemfire-web-api/build.gradle
+++ b/gemfire-web-api/build.gradle
@@ -49,10 +49,6 @@ jar {
   from sourceSets.main.output
 }
 
-artifacts {
-  archives jar
-}
-
 war {
   classpath configurations.runtime
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/gemfire-web/build.gradle
----------------------------------------------------------------------
diff --git a/gemfire-web/build.gradle b/gemfire-web/build.gradle
index 1c926c0..596590b 100755
--- a/gemfire-web/build.gradle
+++ b/gemfire-web/build.gradle
@@ -50,10 +50,6 @@ idea.module.iml {
   }
 }
 
-artifacts {
-  archives jar
-}
-
 war {
   classpath configurations.runtime 
   classpath project(':gemfire-core').webJar.archivePath

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/e9bf2535/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index 0bbbccd..901bdd5 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -13,9 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Buildscript Dependencies
-gradle-maven-publish-auth.version = 2.0.1
-
 # Dependency versions
 activation.version = 1.1.1
 annotations.version = 3.0.0