@@ -27,7 +27,6 @@ import nebula.plugin.info.InfoBrokerPlugin
27
27
import org.apache.commons.io.IOUtils
28
28
import org.elasticsearch.gradle.info.BuildParams
29
29
import org.elasticsearch.gradle.info.GlobalBuildInfoPlugin
30
- import org.elasticsearch.gradle.info.JavaHome
31
30
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
32
31
import org.elasticsearch.gradle.precommit.DependencyLicensesTask
33
32
import org.elasticsearch.gradle.precommit.PrecommitTasks
@@ -56,13 +55,11 @@ import org.gradle.api.artifacts.repositories.IvyPatternRepositoryLayout
56
55
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
57
56
import org.gradle.api.credentials.HttpHeaderCredentials
58
57
import org.gradle.api.execution.TaskActionListener
59
- import org.gradle.api.execution.TaskExecutionGraph
60
58
import org.gradle.api.file.CopySpec
61
59
import org.gradle.api.plugins.BasePlugin
62
60
import org.gradle.api.plugins.BasePluginConvention
63
61
import org.gradle.api.plugins.ExtraPropertiesExtension
64
62
import org.gradle.api.plugins.JavaPlugin
65
- import org.gradle.api.plugins.JavaPluginExtension
66
63
import org.gradle.api.publish.PublishingExtension
67
64
import org.gradle.api.publish.maven.MavenPublication
68
65
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
@@ -71,16 +68,13 @@ import org.gradle.api.tasks.SourceSet
71
68
import org.gradle.api.tasks.SourceSetContainer
72
69
import org.gradle.api.tasks.TaskProvider
73
70
import org.gradle.api.tasks.bundling.Jar
74
- import org.gradle.api.tasks.compile.GroovyCompile
75
71
import org.gradle.api.tasks.compile.JavaCompile
76
72
import org.gradle.api.tasks.javadoc.Javadoc
77
73
import org.gradle.api.tasks.testing.Test
78
- import org.gradle.api.tasks.testing.logging.TestLoggingContainer
79
74
import org.gradle.authentication.http.HttpHeaderAuthentication
80
75
import org.gradle.external.javadoc.CoreJavadocOptions
81
76
import org.gradle.internal.jvm.Jvm
82
77
import org.gradle.language.base.plugins.LifecycleBasePlugin
83
- import org.gradle.process.CommandLineArgumentProvider
84
78
import org.gradle.util.GradleVersion
85
79
86
80
import java.nio.charset.StandardCharsets
@@ -313,6 +307,16 @@ class BuildPlugin implements Plugin<Project> {
313
307
314
308
/* *Configuration generation of maven poms. */
315
309
static void configurePomGeneration (Project project ) {
310
+ // have to defer this until archivesBaseName is set
311
+ project. afterEvaluate {
312
+ project. pluginManager. withPlugin(' maven-publish' ) {
313
+ PublishingExtension publishing = project. extensions. getByType(PublishingExtension )
314
+ publishing. publications. withType(MavenPublication ) { MavenPublication publication ->
315
+ publication. artifactId = project. convention. getPlugin(BasePluginConvention ). archivesBaseName
316
+ }
317
+ }
318
+ }
319
+
316
320
project. plugins. withType(MavenPublishPlugin ). whenPluginAdded {
317
321
TaskProvider generatePomTask = project. tasks. register(" generatePom" ) { Task task ->
318
322
task. dependsOn ' generatePomFileForNebulaPublication'
@@ -323,7 +327,7 @@ class BuildPlugin implements Plugin<Project> {
323
327
}
324
328
325
329
project. tasks. withType(GenerateMavenPom ). configureEach({ GenerateMavenPom pomTask ->
326
- pomTask. destination = " ${ project.buildDir} /distributions/${ project.convention.getPlugin(BasePluginConvention).archivesBaseName} -${ project.version} .pom"
330
+ pomTask. destination = { " ${ project.buildDir} /distributions/${ project.convention.getPlugin(BasePluginConvention).archivesBaseName} -${ project.version} .pom" }
327
331
} as Action<GenerateMavenPom > )
328
332
329
333
PublishingExtension publishing = project. extensions. getByType(PublishingExtension )
@@ -336,7 +340,7 @@ class BuildPlugin implements Plugin<Project> {
336
340
// Here we manually add any project dependencies in the "shadow" configuration to our generated POM
337
341
publication. pom. withXml(this . &addScmInfo)
338
342
publication. pom. withXml { xml ->
339
- Node root = xml. asNode();
343
+ Node root = xml. asNode()
340
344
root. appendNode(' name' , project. name)
341
345
root. appendNode(' description' , project. description)
342
346
Node dependenciesNode = (root. get(' dependencies' ) as NodeList ). get(0 ) as Node
0 commit comments