You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2020/10/04 17:18:39 UTC

[lucene-solr] branch master updated: LUCENE-9548: Apache repository publishing (#1929)

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git


The following commit(s) were added to refs/heads/master by this push:
     new d9a4109  LUCENE-9548: Apache repository publishing (#1929)
d9a4109 is described below

commit d9a410920af66bc288d36bd4213966aadcfe50fc
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Sun Oct 4 19:18:29 2020 +0200

    LUCENE-9548: Apache repository publishing (#1929)
---
 gradle/maven/defaults-maven.gradle | 164 ++++++++++++++++++++++++++++++++-----
 gradle/maven/maven-local.gradle    |  15 +++-
 2 files changed, 157 insertions(+), 22 deletions(-)

diff --git a/gradle/maven/defaults-maven.gradle b/gradle/maven/defaults-maven.gradle
index 83e0051..a856990 100644
--- a/gradle/maven/defaults-maven.gradle
+++ b/gradle/maven/defaults-maven.gradle
@@ -68,6 +68,8 @@ configure(rootProject) {
         ":solr:contrib:prometheus-exporter",
         ":solr:test-framework",
     ]
+
+    apacheNexusSnapshots = "https://repository.apache.org/content/repositories/snapshots"
   }
 }
 
@@ -76,7 +78,26 @@ configure(subprojects.findAll { it.path in rootProject.published }) { prj ->
   apply plugin: 'signing'
 
   publishing {
-    // TODO: Add publishing repository details.
+    repositories {
+      maven {
+        name = "ApacheSnapshots"
+        url = apacheNexusSnapshots
+
+        credentials {
+          def nexusUserName = rootProject.propertyOrDefault('asfNexusUsername', null)
+          def nexusPwd = rootProject.propertyOrDefault('asfNexusPassword', null)
+          if (nexusUserName && nexusPwd) {
+            username nexusUserName
+            password nexusPwd
+          }
+        }
+      }
+    }
+  }
+
+  // Do not generate gradle metadata files.
+  tasks.withType(GenerateModuleMetadata) {
+    enabled = false
   }
 
   plugins.withType(JavaPlugin) {
@@ -101,30 +122,126 @@ configure(subprojects.findAll { it.path in rootProject.published }) { prj ->
     // in gradle or just complex relationships between lazy collection hooks.
     gradle.projectsEvaluated {
       publishing {
-        def configurePom = {
-          name = "Apache Solr/Lucene (${project.name})"
-          licenses {
-            license {
-              name = 'Apache 2'
-              url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+        def configurePom;
+        if (project.path.startsWith(":lucene")) {
+          configurePom = {
+            name = "Apache Lucene (module: ${project.name})"
+            description = name
+            url = 'https://lucene.apache.org/'
+
+            licenses {
+              license {
+                name = 'Apache 2'
+                url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+              }
+            }
+
+            inceptionYear = "2000"
+
+            issueManagement {
+              system = "JIRA"
+              url = "https://issues.apache.org/jira/browse/LUCENE"
+            }
+
+            ciManagement {
+              system = "Jenkins"
+              url = "https://builds.apache.org/job/Lucene/"
+            }
+
+            mailingLists {
+              mailingList {
+                name = "General List"
+                subscribe = "general-subscribe@lucene.apache.org"
+                unsubscribe = "general-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-general/"
+              }
+
+              mailingList {
+                name = "Java User List"
+                subscribe = "java-user-subscribe@lucene.apache.org"
+                unsubscribe = "java-user-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-java-user/"
+              }
+
+              mailingList {
+                name = "Java Developer List"
+                subscribe = "dev-subscribe@lucene.apache.org"
+                unsubscribe = "dev-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-dev/"
+              }
+
+              mailingList {
+                name = "Java Commits List"
+                subscribe = "commits-subscribe@lucene.apache.org"
+                unsubscribe = "commits-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-java-commits/"
+              }
+            }
+
+            scm {
+              connection = 'scm:git:https://gitbox.apache.org/repos/asf/lucene-solr.git'
+              developerConnection = 'scm:git:https://gitbox.apache.org/repos/asf/lucene-solr.git'
+              url = 'https://gitbox.apache.org/repos/asf?p=lucene-solr.git'
             }
           }
-        }
+        } else {
+          configurePom = {
+            name = "Apache Solr (module: ${project.name})"
+            description = name
+            url = 'https://lucene.apache.org/solr/'
 
-        publications {
-          // JARS and sources, no javadocs (for local inspection only).
-          jars(MavenPublication) {
-            from components.java
-            groupId = project.group
-            artifactId = project.archivesBaseName
+            licenses {
+              license {
+                name = 'Apache 2'
+                url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
+              }
+            }
 
-            artifact sourcesJar
+            inceptionYear = "2006"
 
-            pom(configurePom)
+            issueManagement {
+              system = "JIRA"
+              url = "https://issues.apache.org/jira/browse/SOLR"
+            }
+
+            ciManagement {
+              system = "Jenkins"
+              url = "https://builds.apache.org/job/Lucene/"
+            }
+
+            mailingLists {
+              mailingList {
+                name = "Solr User List"
+                subscribe = "solr-user-subscribe@lucene.apache.org"
+                unsubscribe = "solr-user-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/solr-user/"
+              }
+
+              mailingList {
+                name = "Java Developer List"
+                subscribe = "dev-subscribe@lucene.apache.org"
+                unsubscribe = "dev-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-dev/"
+              }
+
+              mailingList {
+                name = "Java Commits List"
+                subscribe = "commits-subscribe@lucene.apache.org"
+                unsubscribe = "commits-unsubscribe@lucene.apache.org"
+                archive = "https://mail-archives.apache.org/mod_mbox/lucene-java-commits/"
+              }
+            }
+
+            scm {
+              connection = 'scm:git:https://gitbox.apache.org/repos/asf/lucene-solr.git'
+              developerConnection = 'scm:git:https://gitbox.apache.org/repos/asf/lucene-solr.git'
+              url = 'https://gitbox.apache.org/repos/asf?p=lucene-solr.git'
+            }
           }
+        }
 
-          // Full set of signed artifacts.
-          signed(MavenPublication) {
+        publications {
+          jars(MavenPublication) {
             from components.java
             groupId = project.group
             artifactId = project.archivesBaseName
@@ -137,8 +254,17 @@ configure(subprojects.findAll { it.path in rootProject.published }) { prj ->
         }
       }
 
+      // Add aliases of convention tasks with shorter names.
+      task mavenToApacheSnapshots() {
+        group "Publishing"
+        description "Publish Maven JARs and POMs to Apache Snapshots repository: ${apacheNexusSnapshots}"
+
+        dependsOn "publishJarsPublicationToApacheSnapshotsRepository"
+      }
+
       signing {
-        sign publishing.publications.signed
+        required { !version.endsWith("SNAPSHOT") }
+        sign publishing.publications.jars
       }
     }
   }
diff --git a/gradle/maven/maven-local.gradle b/gradle/maven/maven-local.gradle
index d6a6fdf..9d415b8 100644
--- a/gradle/maven/maven-local.gradle
+++ b/gradle/maven/maven-local.gradle
@@ -24,7 +24,7 @@ configure(rootProject) {
     mavenLocalDir = file("${buildDir}/maven-local")
   }
 
-  task mavenLocal() {
+  task mavenToLocalFolder() {
     group "Publishing"
     description "Publish Maven JARs and POMs locally to " + mavenLocalDir
 
@@ -33,6 +33,11 @@ configure(rootProject) {
     }
   }
 
+  task mavenToLocalRepo() {
+    group "Publishing"
+    description "Publish Maven JARs and POMs to current user's local maven repository."
+  }
+
   task mavenLocalClean(type: Delete) {
     delete mavenLocalDir
   }
@@ -48,11 +53,15 @@ configure(rootProject) {
         }
       }
 
+      tasks.matching { it.name == "publishJarsPublicationToMavenLocal" }.all { task ->
+        mavenToLocalRepo.dependsOn task
+      }
+
       tasks.matching { it.name == "publishJarsPublicationToBuildRepository" }.all { task ->
-        // Clean prior to republishing to local build repository.
+        // Clean local repo prior to republishing artifacts.
         task.dependsOn mavenLocalClean
         // Attach to root project's mavenLocal task.
-        mavenLocal.dependsOn task
+        mavenToLocalFolder.dependsOn task
       }
     }
   }