From 5aea24137cdcfa6e0b24a54a11c586a7ff9e9e0b Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Fri, 13 May 2016 16:32:35 -0700 Subject: [PATCH] Build: More pom generation improvements This adds a non empty description to all generated poms, as well as fixing distributions so they actually have a generated pom. --- build.gradle | 1 + .../groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 6 +++--- .../elasticsearch/gradle/plugin/PluginBuildPlugin.groovy | 7 ++++--- distribution/build.gradle | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 6484a356857..3d52d4ab279 100644 --- a/build.gradle +++ b/build.gradle @@ -27,6 +27,7 @@ import org.apache.tools.ant.taskdefs.condition.Os subprojects { group = 'org.elasticsearch' version = org.elasticsearch.gradle.VersionProperties.elasticsearch + description = "Elasticsearch subproject ${project.path}" // we only use maven publish to add tasks for pom generation plugins.withType(MavenPublishPlugin).whenPluginAdded { diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index 2cfd98f276f..029c80b6e25 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -19,6 +19,7 @@ package org.elasticsearch.gradle import nebula.plugin.extraconfigurations.ProvidedBasePlugin +import nebula.plugin.publishing.maven.MavenBasePublishPlugin import org.elasticsearch.gradle.precommit.PrecommitTasks import org.gradle.api.GradleException import org.gradle.api.JavaVersion @@ -34,7 +35,6 @@ import org.gradle.api.artifacts.ResolvedArtifact import org.gradle.api.artifacts.dsl.RepositoryHandler import org.gradle.api.artifacts.maven.MavenPom import org.gradle.api.publish.maven.MavenPublication -import org.gradle.api.publish.maven.plugins.MavenPublishPlugin import org.gradle.api.publish.maven.tasks.GenerateMavenPom import org.gradle.api.tasks.bundling.Jar import org.gradle.api.tasks.compile.JavaCompile @@ -343,8 +343,8 @@ class BuildPlugin implements Plugin { } /**Configuration generation of maven poms. */ - private static void configurePomGeneration(Project project) { - project.plugins.withType(MavenPublishPlugin.class).whenPluginAdded { + public static void configurePomGeneration(Project project) { + project.plugins.withType(MavenBasePublishPlugin.class).whenPluginAdded { project.publishing { publications { all { MavenPublication publication -> // we only deal with maven diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy index 36770ab35f7..7ff83f4eae3 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy @@ -18,6 +18,7 @@ */ package org.elasticsearch.gradle.plugin +import nebula.plugin.publishing.maven.MavenBasePublishPlugin import nebula.plugin.publishing.maven.MavenManifestPlugin import nebula.plugin.publishing.maven.MavenScmPlugin import org.elasticsearch.gradle.BuildPlugin @@ -51,7 +52,7 @@ public class PluginBuildPlugin extends BuildPlugin { } else { project.integTest.clusterConfig.plugin(name, project.bundlePlugin.outputs.files) project.tasks.run.clusterConfig.plugin(name, project.bundlePlugin.outputs.files) - configurePomGeneration(project) + addPomGeneration(project) } project.namingConventions { @@ -131,9 +132,9 @@ public class PluginBuildPlugin extends BuildPlugin { /** * Adds the plugin jar and zip as publications. */ - private static void configurePomGeneration(Project project) { + protected static void addPomGeneration(Project project) { + project.plugins.apply(MavenBasePublishPlugin.class) project.plugins.apply(MavenScmPlugin.class) - project.plugins.apply(MavenManifestPlugin.class) project.publishing { publications { diff --git a/distribution/build.gradle b/distribution/build.gradle index 44949cd0604..40fb6b64f99 100644 --- a/distribution/build.gradle +++ b/distribution/build.gradle @@ -20,6 +20,7 @@ import org.apache.tools.ant.filters.FixCrLfFilter import org.apache.tools.ant.taskdefs.condition.Os +import org.elasticsearch.gradle.BuildPlugin import org.elasticsearch.gradle.EmptyDirTask import org.elasticsearch.gradle.MavenFilteringHack import org.elasticsearch.gradle.precommit.DependencyLicensesTask @@ -114,6 +115,7 @@ subprojects { *****************************************************************************/ // note: the group must be correct before applying the nexus plugin, or it will capture the wrong value... project.group = "org.elasticsearch.distribution.${project.name}" + project.archivesBaseName = 'elasticsearch' apply plugin: 'com.bmuschko.nexus' // we must create our own install task, because it is only added when the java plugin is added task install(type: Upload, description: "Installs the 'archives' artifacts into the local Maven repository.", group: 'Upload') { @@ -162,6 +164,8 @@ subprojects { /***************************************************************************** * Publishing setup * *****************************************************************************/ + BuildPlugin.configurePomGeneration(project) + apply plugin: 'nebula.info-scm' apply plugin: 'nebula.maven-base-publish' apply plugin: 'nebula.maven-scm' publishing {