Skip to content

Commit 34df30d

Browse files
committed
Build: Remove pom generation for plugin zip files (#32180)
In 1.x and 2.x, plugins were published to maven and the plugin installer downloaded them from there. This was later changed to install from the download service, and in 5.0 plugin zips were no longer published to maven. However, the build still currently produces an unused pom file. This is troublesome in the special case when the main jar of a plugin needs to be published (and thus needs a pom file of the same name). closes #31946
1 parent d190b11 commit 34df30d

File tree

1 file changed

+7
-29
lines changed

1 file changed

+7
-29
lines changed

buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ public class PluginBuildPlugin extends BuildPlugin {
6161
// and generate a different pom for the zip
6262
addClientJarPomGeneration(project)
6363
addClientJarTask(project)
64-
} else {
65-
// no client plugin, so use the pom file from nebula, without jar, for the zip
66-
project.ext.set("nebulaPublish.maven.jar", false)
6764
}
65+
// while the jar isn't normally published, we still at least build a pom of deps
66+
// in case it is published, for instance when other plugins extend this plugin
67+
configureJarPom(project)
6868

6969
project.integTestCluster.dependsOn(project.bundlePlugin)
7070
project.tasks.run.dependsOn(project.bundlePlugin)
@@ -78,7 +78,6 @@ public class PluginBuildPlugin extends BuildPlugin {
7878
}
7979

8080
if (isModule == false || isXPackModule) {
81-
addZipPomGeneration(project)
8281
addNoticeGeneration(project)
8382
}
8483

@@ -221,36 +220,15 @@ public class PluginBuildPlugin extends BuildPlugin {
221220
}
222221
}
223222

224-
/** Adds a task to generate a pom file for the zip distribution. */
225-
public static void addZipPomGeneration(Project project) {
223+
/** Configure the pom for the main jar of this plugin */
224+
protected static void configureJarPom(Project project) {
226225
project.plugins.apply(ScmInfoPlugin.class)
227226
project.plugins.apply(MavenPublishPlugin.class)
228227

229228
project.publishing {
230229
publications {
231-
zip(MavenPublication) {
232-
artifact project.bundlePlugin
233-
}
234-
/* HUGE HACK: the underlying maven publication library refuses to deploy any attached artifacts
235-
* when the packaging type is set to 'pom'. But Sonatype's OSS repositories require source files
236-
* for artifacts that are of type 'zip'. We already publish the source and javadoc for Elasticsearch
237-
* under the various other subprojects. So here we create another publication using the same
238-
* name that has the "real" pom, and rely on the fact that gradle will execute the publish tasks
239-
* in alphabetical order. This lets us publish the zip file and even though the pom says the
240-
* type is 'pom' instead of 'zip'. We cannot setup a dependency between the tasks because the
241-
* publishing tasks are created *extremely* late in the configuration phase, so that we cannot get
242-
* ahold of the actual task. Furthermore, this entire hack only exists so we can make publishing to
243-
* maven local work, since we publish to maven central externally. */
244-
zipReal(MavenPublication) {
245-
artifactId = project.pluginProperties.extension.name
246-
pom.withXml { XmlProvider xml ->
247-
Node root = xml.asNode()
248-
root.appendNode('name', project.pluginProperties.extension.name)
249-
root.appendNode('description', project.pluginProperties.extension.description)
250-
root.appendNode('url', urlFromOrigin(project.scminfo.origin))
251-
Node scmNode = root.appendNode('scm')
252-
scmNode.appendNode('url', project.scminfo.origin)
253-
}
230+
nebula(MavenPublication) {
231+
artifactId project.pluginProperties.extension.name
254232
}
255233
}
256234
}

0 commit comments

Comments
 (0)