Always use archive base name as the pom artifact id (#56447) (#56467)

This commit is contained in:
Mark Vieira 2020-05-08 16:11:19 -07:00 committed by GitHub
parent 6ae7327061
commit 0fb9bc5379
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 48 deletions

View File

@ -27,7 +27,6 @@ import nebula.plugin.info.InfoBrokerPlugin
import org.apache.commons.io.IOUtils
import org.elasticsearch.gradle.info.BuildParams
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
import org.elasticsearch.gradle.info.JavaHome
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
import org.elasticsearch.gradle.precommit.PrecommitTasks
@ -56,13 +55,11 @@ import org.gradle.api.artifacts.repositories.IvyPatternRepositoryLayout
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.credentials.HttpHeaderCredentials
import org.gradle.api.execution.TaskActionListener
import org.gradle.api.execution.TaskExecutionGraph
import org.gradle.api.file.CopySpec
import org.gradle.api.plugins.BasePlugin
import org.gradle.api.plugins.BasePluginConvention
import org.gradle.api.plugins.ExtraPropertiesExtension
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
@ -71,16 +68,13 @@ import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.SourceSetContainer
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.bundling.Jar
import org.gradle.api.tasks.compile.GroovyCompile
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.api.tasks.javadoc.Javadoc
import org.gradle.api.tasks.testing.Test
import org.gradle.api.tasks.testing.logging.TestLoggingContainer
import org.gradle.authentication.http.HttpHeaderAuthentication
import org.gradle.external.javadoc.CoreJavadocOptions
import org.gradle.internal.jvm.Jvm
import org.gradle.language.base.plugins.LifecycleBasePlugin
import org.gradle.process.CommandLineArgumentProvider
import org.gradle.util.GradleVersion
import java.nio.charset.StandardCharsets
@ -313,6 +307,16 @@ class BuildPlugin implements Plugin<Project> {
/**Configuration generation of maven poms. */
static void configurePomGeneration(Project project) {
// have to defer this until archivesBaseName is set
project.afterEvaluate {
project.pluginManager.withPlugin('maven-publish') {
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
publishing.publications.withType(MavenPublication) { MavenPublication publication ->
publication.artifactId = project.convention.getPlugin(BasePluginConvention).archivesBaseName
}
}
}
project.plugins.withType(MavenPublishPlugin).whenPluginAdded {
TaskProvider generatePomTask = project.tasks.register("generatePom") { Task task ->
task.dependsOn 'generatePomFileForNebulaPublication'
@ -323,7 +327,7 @@ class BuildPlugin implements Plugin<Project> {
}
project.tasks.withType(GenerateMavenPom).configureEach({ GenerateMavenPom pomTask ->
pomTask.destination = "${project.buildDir}/distributions/${project.convention.getPlugin(BasePluginConvention).archivesBaseName}-${project.version}.pom"
pomTask.destination = { "${project.buildDir}/distributions/${project.convention.getPlugin(BasePluginConvention).archivesBaseName}-${project.version}.pom" }
} as Action<GenerateMavenPom>)
PublishingExtension publishing = project.extensions.getByType(PublishingExtension)
@ -336,7 +340,7 @@ class BuildPlugin implements Plugin<Project> {
// Here we manually add any project dependencies in the "shadow" configuration to our generated POM
publication.pom.withXml(this.&addScmInfo)
publication.pom.withXml { xml ->
Node root = xml.asNode();
Node root = xml.asNode()
root.appendNode('name', project.name)
root.appendNode('description', project.description)
Node dependenciesNode = (root.get('dependencies') as NodeList).get(0) as Node

View File

@ -27,14 +27,6 @@ sourceCompatibility = JavaVersion.VERSION_1_8
group = 'org.elasticsearch.client'
archivesBaseName = 'elasticsearch-rest-client'
publishing {
publications {
nebula {
artifactId = archivesBaseName
}
}
}
dependencies {
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"

View File

@ -25,14 +25,6 @@ sourceCompatibility = JavaVersion.VERSION_1_8
group = 'org.elasticsearch.client'
archivesBaseName = 'elasticsearch-rest-client-sniffer'
publishing {
publications {
nebula {
artifactId = archivesBaseName
}
}
}
dependencies {
compile project(":client:rest")
compile "org.apache.httpcomponents:httpclient:${versions.httpclient}"

View File

@ -63,14 +63,6 @@ if (!isEclipse) {
}
}
publishing {
publications {
nebula {
artifactId = archivesBaseName
}
}
}
dependencies {
// This dependency is used only by :libs:core for null-checking interop with other tools
compileOnly "com.google.code.findbugs:jsr305:3.0.2"

View File

@ -23,14 +23,6 @@ apply plugin: 'nebula.maven-base-publish'
group = 'org.elasticsearch.plugin'
archivesBaseName = 'elasticsearch-scripting-painless-spi'
publishing {
publications {
nebula {
artifactId = archivesBaseName
}
}
}
dependencies {
compile project(":server")
}

View File

@ -30,11 +30,3 @@ testingConventions {
}
}
}
publishing {
publications {
nebula(MavenPublication) {
artifactId = archivesBaseName
}
}
}