diff --git a/elasticsearch/x-pack/build.gradle b/elasticsearch/x-pack/build.gradle index af87c22bbfc..aa766757784 100644 --- a/elasticsearch/x-pack/build.gradle +++ b/elasticsearch/x-pack/build.gradle @@ -1,6 +1,9 @@ +import java.nio.charset.StandardCharsets +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.StandardCopyOption import org.elasticsearch.gradle.MavenFilteringHack import org.elasticsearch.gradle.test.NodeInfo -import java.nio.charset.StandardCharsets group 'org.elasticsearch.plugin' @@ -9,6 +12,7 @@ esplugin { name 'x-pack' description 'Elasticsearch Expanded Pack Plugin' classname 'org.elasticsearch.xpack.XPackPlugin' + hasClientJar = true } ext.versions = [ @@ -128,6 +132,37 @@ bundlePlugin { } } +// add api jar for extension authors to compile against +// note this is just the normal x-pack jar for now, with a different name +project.afterEvaluate { + task apiJar { + dependsOn('generatePomFileForApijarPublication', project.jar) + doFirst { + Path jarFile = project.jar.outputs.files.singleFile.toPath() + String apiFileName = jarFile.fileName.toString().replace(project.version, "api-${project.version}") + Files.copy(jarFile, jarFile.resolveSibling(apiFileName), StandardCopyOption.REPLACE_EXISTING) + + String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom') + String apiPomFileName = apiFileName.replace('.jar', '.pom') + Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(apiPomFileName), + StandardCopyOption.REPLACE_EXISTING) + } + } + project.publishing { + publications { + apijar(MavenPublication) { + from project.components.java + artifactId = artifactId + '-api' + pom.withXml { XmlProvider xml -> + Node root = xml.asNode() + root.appendNode('name', project.pluginProperties.extension.name) + root.appendNode('description', project.pluginProperties.extension.description) + } + } + } + } +} + integTest { // TODO: fix this rest test to not depend on a hardcoded port! systemProperty 'tests.rest.blacklist', 'getting_started/10_monitor_cluster_health/*,bulk/10_basic/*'