summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Ernst <ryan@iernst.net>2016-09-19 15:10:41 -0700
committerGitHub <noreply@github.com>2016-09-19 15:10:41 -0700
commit85b8f294152714273c3dadf790bd6e67c1598139 (patch)
tree1ec2608f3aeae183d3b6c15880a85bd18f7ded10
parente2854bb3a4ddb7465395f2813f6074918c74e361 (diff)
Build: Remove old maven deploy support (#20403)
* Build: Remove old maven deploy support This change removes the old maven deploy that we have in parallel to maven-publish, and makes maven-publish fully work with publishing to maven local. Using `gradle publishToMavenLocal` should be used to publish to .m2. Note that there is an unfortunate hack that means for zip artifacts we must first create/publish a dummy pom file, and then follow that with the real pom file. It would be nice to have the pom file contains packaging=zip, but maven central then requires sources and javadocs. But our zips are really just attached artifacts, so we already set the packaging type to pom for our zip files. This change just works around a limitation of the underlying maven publishing library which silently skips attached artifacts when the packaging type is set to pom. relates #20164 closes #20375 * Remove unnecessary extra spacing
-rw-r--r--build.gradle63
-rw-r--r--buildSrc/build.gradle1
-rw-r--r--buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy30
-rw-r--r--buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy23
-rw-r--r--client/benchmark/build.gradle4
-rw-r--r--client/client-benchmark-noop-api-plugin/build.gradle1
-rw-r--r--client/test/build.gradle5
-rw-r--r--core/build.gradle1
-rw-r--r--distribution/build.gradle22
-rw-r--r--distribution/integ-test-zip/build.gradle5
-rw-r--r--distribution/tar/build.gradle4
-rw-r--r--distribution/zip/build.gradle5
-rw-r--r--modules/build.gradle4
-rw-r--r--plugins/build.gradle1
14 files changed, 49 insertions, 120 deletions
diff --git a/build.gradle b/build.gradle
index f1b57d7857..e1ab457663 100644
--- a/build.gradle
+++ b/build.gradle
@@ -17,7 +17,6 @@
* under the License.
*/
-import com.bmuschko.gradle.nexus.NexusPlugin
import org.eclipse.jgit.lib.Repository
import org.eclipse.jgit.lib.RepositoryBuilder
import org.gradle.plugins.ide.eclipse.model.SourceFolder
@@ -52,68 +51,6 @@ subprojects {
}
}
}
-
- plugins.withType(NexusPlugin).whenPluginAdded {
- modifyPom {
- project {
- url 'https://github.com/elastic/elasticsearch'
- inceptionYear '2009'
-
- scm {
- url 'https://github.com/elastic/elasticsearch'
- connection 'scm:https://elastic@github.com/elastic/elasticsearch'
- developerConnection 'scm:git://github.com/elastic/elasticsearch.git'
- }
-
- licenses {
- license {
- name 'The Apache Software License, Version 2.0'
- url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
- distribution 'repo'
- }
- }
- }
- }
- extraArchive {
- javadoc = true
- tests = false
- }
- nexus {
- String buildSnapshot = System.getProperty('build.snapshot', 'true')
- if (buildSnapshot == 'false') {
- Repository repo = new RepositoryBuilder().findGitDir(project.rootDir).build()
- String shortHash = repo.resolve('HEAD')?.name?.substring(0,7)
- repositoryUrl = project.hasProperty('build.repository') ? project.property('build.repository') : "file://${System.getenv('HOME')}/elasticsearch-releases/${version}-${shortHash}/"
- }
- }
- // we have our own username/password prompts so that they only happen once
- // TODO: add gpg signing prompts, which is tricky, as the buildDeb/buildRpm tasks are executed before this code block
- project.gradle.taskGraph.whenReady { taskGraph ->
- if (taskGraph.allTasks.any { it.name == 'uploadArchives' }) {
- Console console = System.console()
- // no need for username/password on local deploy
- if (project.nexus.repositoryUrl.startsWith('file://')) {
- project.rootProject.allprojects.each {
- it.ext.nexusUsername = 'foo'
- it.ext.nexusPassword = 'bar'
- }
- } else {
- if (project.hasProperty('nexusUsername') == false) {
- String nexusUsername = console.readLine('\nNexus username: ')
- project.rootProject.allprojects.each {
- it.ext.nexusUsername = nexusUsername
- }
- }
- if (project.hasProperty('nexusPassword') == false) {
- String nexusPassword = new String(console.readPassword('\nNexus password: '))
- project.rootProject.allprojects.each {
- it.ext.nexusPassword = nexusPassword
- }
- }
- }
- }
- }
- }
}
allprojects {
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
index 163fd3dcae..0e8c2dc141 100644
--- a/buildSrc/build.gradle
+++ b/buildSrc/build.gradle
@@ -95,7 +95,6 @@ dependencies {
compile 'org.eclipse.jgit:org.eclipse.jgit:3.2.0.201312181205-r'
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
compile 'de.thetaphi:forbiddenapis:2.2'
- compile 'com.bmuschko:gradle-nexus-plugin:2.3.1'
compile 'org.apache.rat:apache-rat:0.11'
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1'
}
diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
index 0462b0cd33..ebe4a2bdcc 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy
@@ -28,11 +28,10 @@ import org.gradle.api.Task
import org.gradle.api.XmlProvider
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ModuleDependency
-import org.gradle.api.artifacts.ModuleVersionIdentifier
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.dsl.RepositoryHandler
-import org.gradle.api.artifacts.maven.MavenPom
+import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.plugins.MavenPublishPlugin
import org.gradle.api.publish.maven.tasks.GenerateMavenPom
@@ -63,7 +62,6 @@ class BuildPlugin implements Plugin<Project> {
project.pluginManager.apply('nebula.info-java')
project.pluginManager.apply('nebula.info-scm')
project.pluginManager.apply('nebula.info-jar')
- project.pluginManager.apply('com.bmuschko.nexus')
project.pluginManager.apply(ProvidedBasePlugin)
globalBuildInfo(project)
@@ -71,6 +69,8 @@ class BuildPlugin implements Plugin<Project> {
configureConfigurations(project)
project.ext.versions = VersionProperties.versions
configureCompile(project)
+ configureJavadocJar(project)
+ configureSourcesJar(project)
configurePomGeneration(project)
configureTest(project)
@@ -267,11 +267,6 @@ class BuildPlugin implements Plugin<Project> {
project.configurations.compile.dependencies.all(disableTransitiveDeps)
project.configurations.testCompile.dependencies.all(disableTransitiveDeps)
project.configurations.provided.dependencies.all(disableTransitiveDeps)
-
- // add exclusions to the pom directly, for each of the transitive deps of this project's deps
- project.modifyPom { MavenPom pom ->
- pom.withXml(fixupDependencies(project))
- }
}
/** Adds repositores used by ES dependencies */
@@ -411,6 +406,25 @@ class BuildPlugin implements Plugin<Project> {
}
}
+ /** Adds a javadocJar task to generate a jar containing javadocs. */
+ static void configureJavadocJar(Project project) {
+ Jar javadocJarTask = project.task('javadocJar', type: Jar)
+ javadocJarTask.classifier = 'javadoc'
+ javadocJarTask.group = 'build'
+ javadocJarTask.description = 'Assembles a jar containing javadocs.'
+ javadocJarTask.from(project.tasks.getByName(JavaPlugin.JAVADOC_TASK_NAME))
+ project.assemble.dependsOn(javadocJarTask)
+ }
+
+ static void configureSourcesJar(Project project) {
+ Jar sourcesJarTask = project.task('sourcesJar', type: Jar)
+ sourcesJarTask.classifier = 'sources'
+ sourcesJarTask.group = 'build'
+ sourcesJarTask.description = 'Assembles a jar containing source files.'
+ sourcesJarTask.from(project.sourceSets.main.allSource)
+ project.assemble.dependsOn(sourcesJarTask)
+ }
+
/** Adds additional manifest info to jars, and adds source and javadoc jars */
static void configureJars(Project project) {
project.tasks.withType(Jar) { Jar jarTask ->
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 0a454ee100..0908505185 100644
--- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
+++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/plugin/PluginBuildPlugin.groovy
@@ -56,12 +56,8 @@ public class PluginBuildPlugin extends BuildPlugin {
// for plugins which work with the transport client, we copy the jar
// file to a new name, copy the nebula generated pom to the same name,
// and generate a different pom for the zip
- project.signArchives.enabled = false
addClientJarPomGeneration(project)
addClientJarTask(project)
- if (isModule == false) {
- addZipPomGeneration(project)
- }
} else {
// no client plugin, so use the pom file from nebula, without jar, for the zip
project.ext.set("nebulaPublish.maven.jar", false)
@@ -152,17 +148,12 @@ public class PluginBuildPlugin extends BuildPlugin {
/** Adds a task to move jar and associated files to a "-client" name. */
protected static void addClientJarTask(Project project) {
Task clientJar = project.tasks.create('clientJar')
- clientJar.dependsOn('generatePomFileForJarPublication', project.jar, project.javadocJar, project.sourcesJar)
+ clientJar.dependsOn(project.jar, project.javadocJar, project.sourcesJar)
clientJar.doFirst {
Path jarFile = project.jar.outputs.files.singleFile.toPath()
String clientFileName = jarFile.fileName.toString().replace(project.version, "client-${project.version}")
Files.copy(jarFile, jarFile.resolveSibling(clientFileName), StandardCopyOption.REPLACE_EXISTING)
- String pomFileName = jarFile.fileName.toString().replace('.jar', '.pom')
- String clientPomFileName = clientFileName.replace('.jar', '.pom')
- Files.copy(jarFile.resolveSibling(pomFileName), jarFile.resolveSibling(clientPomFileName),
- StandardCopyOption.REPLACE_EXISTING)
-
String sourcesFileName = jarFile.fileName.toString().replace('.jar', '-sources.jar')
String clientSourcesFileName = clientFileName.replace('.jar', '-sources.jar')
Files.copy(jarFile.resolveSibling(sourcesFileName), jarFile.resolveSibling(clientSourcesFileName),
@@ -197,7 +188,7 @@ public class PluginBuildPlugin extends BuildPlugin {
project.publishing {
publications {
- jar(MavenPublication) {
+ clientJar(MavenPublication) {
from project.components.java
artifactId = artifactId + '-client'
pom.withXml { XmlProvider xml ->
@@ -221,7 +212,15 @@ public class PluginBuildPlugin extends BuildPlugin {
publications {
zip(MavenPublication) {
artifact project.bundlePlugin
- pom.packaging = 'pom'
+ }
+ // HUGE HACK: the underlying maven publication library refuses to deploy any attached artifacts
+ // when the packaging type is set to 'pom'. So here we create another publication using the same
+ // name that has the "real" pom, and rely on the fact that gradle will execute the publish tasks
+ // in alphabetical order. We cannot setup a dependency between the tasks because the publishing
+ // tasks are created *extremely* late in the configuration phase, so that we cannot get ahold
+ // of the actual task. Furthermore, this entire hack only exists so we can make publishing to
+ // maven local work, since we publish to maven central externally.
+ zipReal(MavenPublication) {
pom.withXml { XmlProvider xml ->
Node root = xml.asNode()
root.appendNode('name', project.pluginProperties.extension.name)
diff --git a/client/benchmark/build.gradle b/client/benchmark/build.gradle
index bd4abddbd1..e17c7b8470 100644
--- a/client/benchmark/build.gradle
+++ b/client/benchmark/build.gradle
@@ -64,7 +64,3 @@ dependencies {
// No licenses for our benchmark deps (we don't ship benchmarks)
dependencyLicenses.enabled = false
-
-extraArchive {
- javadoc = false
-}
diff --git a/client/client-benchmark-noop-api-plugin/build.gradle b/client/client-benchmark-noop-api-plugin/build.gradle
index 9f3af3ce00..a0d52f1591 100644
--- a/client/client-benchmark-noop-api-plugin/build.gradle
+++ b/client/client-benchmark-noop-api-plugin/build.gradle
@@ -20,7 +20,6 @@
group = 'org.elasticsearch.plugin'
apply plugin: 'elasticsearch.esplugin'
-apply plugin: 'com.bmuschko.nexus'
esplugin {
name 'client-benchmark-noop-api'
diff --git a/client/test/build.gradle b/client/test/build.gradle
index a7ffe79ac5..e57d415e9e 100644
--- a/client/test/build.gradle
+++ b/client/test/build.gradle
@@ -26,9 +26,6 @@ apply plugin: 'ru.vyarus.animalsniffer'
targetCompatibility = JavaVersion.VERSION_1_7
sourceCompatibility = JavaVersion.VERSION_1_7
-install.enabled = false
-uploadArchives.enabled = false
-
dependencies {
compile "org.apache.httpcomponents:httpcore:${versions.httpcore}"
compile "com.carrotsearch.randomizedtesting:randomizedtesting-runner:${versions.randomizedrunner}"
@@ -61,4 +58,4 @@ namingConventions.enabled = false
//we aren't releasing this jar
thirdPartyAudit.enabled = false
-test.enabled = false \ No newline at end of file
+test.enabled = false
diff --git a/core/build.gradle b/core/build.gradle
index 4eab7ed5d5..ea2e3e27ef 100644
--- a/core/build.gradle
+++ b/core/build.gradle
@@ -22,7 +22,6 @@ import com.carrotsearch.gradle.junit4.RandomizedTestingTask
import org.elasticsearch.gradle.BuildPlugin
apply plugin: 'elasticsearch.build'
-apply plugin: 'com.bmuschko.nexus'
apply plugin: 'nebula.optional-base'
apply plugin: 'nebula.maven-base-publish'
apply plugin: 'nebula.maven-scm'
diff --git a/distribution/build.gradle b/distribution/build.gradle
index edf9b6a70c..fe172620b5 100644
--- a/distribution/build.gradle
+++ b/distribution/build.gradle
@@ -132,13 +132,6 @@ 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') {
- configuration = configurations.archives
- MavenRepositoryHandlerConvention repositoriesHandler = (MavenRepositoryHandlerConvention)getRepositories().getConvention().getPlugin(MavenRepositoryHandlerConvention)
- repositoriesHandler.mavenInstaller()
- }
// TODO: the map needs to be an input of the tasks, so that when it changes, the task will re-run...
/*****************************************************************************
@@ -191,16 +184,11 @@ subprojects {
/*****************************************************************************
* Publishing setup *
*****************************************************************************/
- BuildPlugin.configurePomGeneration(project)
- apply plugin: 'nebula.info-scm'
- apply plugin: 'nebula.maven-base-publish'
- apply plugin: 'nebula.maven-scm'
- publishing {
- publications {
- nebula {
- artifactId 'elasticsearch'
- }
- }
+ if (['zip', 'integ-test-zip'].contains(it.name)) {
+ BuildPlugin.configurePomGeneration(project)
+ apply plugin: 'nebula.info-scm'
+ apply plugin: 'nebula.maven-base-publish'
+ apply plugin: 'nebula.maven-scm'
}
}
diff --git a/distribution/integ-test-zip/build.gradle b/distribution/integ-test-zip/build.gradle
index f1f3a2c26c..19999ab484 100644
--- a/distribution/integ-test-zip/build.gradle
+++ b/distribution/integ-test-zip/build.gradle
@@ -30,8 +30,13 @@ artifacts {
publishing {
publications {
nebula {
+ artifactId 'elasticsearch'
artifact buildZip
}
+ nebulaRealPom(MavenPublication) {
+ artifactId 'elasticsearch'
+ pom.packaging = 'pom'
+ }
}
}
diff --git a/distribution/tar/build.gradle b/distribution/tar/build.gradle
index 7242565905..8e34a6ce9c 100644
--- a/distribution/tar/build.gradle
+++ b/distribution/tar/build.gradle
@@ -28,9 +28,5 @@ task buildTar(type: Tar) {
artifacts {
'default' buildTar
- project.afterEvaluate {
- // gradle is broken for extensions that contain a dot, so we must be explicit about the name of the .asc file
- project.signArchives.singleSignature.type = 'tar.gz.asc'
- }
}
diff --git a/distribution/zip/build.gradle b/distribution/zip/build.gradle
index 67f99aa884..8b7bb38529 100644
--- a/distribution/zip/build.gradle
+++ b/distribution/zip/build.gradle
@@ -30,8 +30,13 @@ artifacts {
publishing {
publications {
nebula {
+ artifactId 'elasticsearch'
artifact buildZip
}
+ nebulaRealPom(MavenPublication) {
+ artifactId 'elasticsearch'
+ pom.packaging = 'pom'
+ }
}
}
diff --git a/modules/build.gradle b/modules/build.gradle
index 11131c28e2..d5b207625c 100644
--- a/modules/build.gradle
+++ b/modules/build.gradle
@@ -35,8 +35,4 @@ subprojects {
if (project.file('src/main/config').exists()) {
throw new InvalidModelException("Modules cannot contain config files")
}
-
- // these are implementation details of our build, no need to publish them!
- install.enabled = false
- uploadArchives.enabled = false
}
diff --git a/plugins/build.gradle b/plugins/build.gradle
index e49b08c601..8866dfc8ee 100644
--- a/plugins/build.gradle
+++ b/plugins/build.gradle
@@ -22,7 +22,6 @@ configure(subprojects.findAll { it.parent.path == project.path }) {
group = 'org.elasticsearch.plugin'
apply plugin: 'elasticsearch.esplugin'
- apply plugin: 'com.bmuschko.nexus'
esplugin {
// for local ES plugins, the name of the plugin is the same as the directory