Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-9548: Apache repository publishing (#1929)

Dawid Weissd9a410920af6
diff --git a/gradle/maven/defaults-maven.gradle b/gradle/maven/defaults-maven.gradle
index 83e0051a882..a8569909132 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 = "[email protected]"
+ unsubscribe = "[email protected]"
+ archive = "https://mail-archives.apache.org/mod_mbox/lucene-general/"
+ }
+
+ mailingList {
+ name = "Java User List"
+ subscribe = "[email protected]"
+ unsubscribe = "[email protected]"
+ archive = "https://mail-archives.apache.org/mod_mbox/lucene-java-user/"
+ }
+
+ mailingList {
+ name = "Java Developer List"
+ subscribe = "[email protected]"
+ unsubscribe = "[email protected]"
+ archive = "https://mail-archives.apache.org/mod_mbox/lucene-dev/"
+ }
+
+ mailingList {
+ name = "Java Commits List"
+ subscribe = "[email protected]"
+ unsubscribe = "[email protected]"
+ 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 = "[email protected]"
+ unsubscribe = "[email protected]"
+ archive = "https://mail-archives.apache.org/mod_mbox/solr-user/"
+ }
+
+ mailingList {
+ name = "Java Developer List"
+ subscribe = "[email protected]"
+ unsubscribe = "[email protected]"
+ archive = "https://mail-archives.apache.org/mod_mbox/lucene-dev/"
+ }
+
+ mailingList {
+ name = "Java Commits List"
+ subscribe = "[email protected]"
+ unsubscribe = "[email protected]"
+ 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 d6a6fdf4aff..9d415b89463 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
}
}
}