Skip to content

Instantly share code, notes, and snippets.

@thelmstedt
Created May 15, 2017 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thelmstedt/becfa5457c42a3749d5a8519c8c5d905 to your computer and use it in GitHub Desktop.
Save thelmstedt/becfa5457c42a3749d5a8519c8c5d905 to your computer and use it in GitHub Desktop.
Gradle setup for elasticsearch >= 5.x plugin dependencies
apply plugin: "java"
repositories {
mavenCentral()
ivy {
url "https://artifacts.elastic.co/downloads/elasticsearch-plugins/"
layout 'pattern', {
// https://artifacts.elastic.co/downloads/elasticsearch-plugins/analysis-phonetic/analysis-phonetic-5.4.0.zip
artifact '/[module]/[module]-[revision].[ext]'
}
}
}
configurations {
zipped
}
task installDependencies(type: Sync) {
def extractDir = "${buildDir}/my-libs"
ext.extractedJars = fileTree(extractDir) {
include "**/*.jar"
builtBy "installDependencies"
}
dependsOn configurations.zipped
from {
configurations.zipped.collect { zipTree(it) }
}
into extractDir
}
dependencies {
compile "org.elasticsearch:elasticsearch:5.4.0"
zipped "org.elasticsearch.plugin:analysis-phonetic:5.4.0@zip"
compile files({ tasks.installDependencies.extractedJars })
}
@thelmstedt
Copy link
Author

thelmstedt commented May 15, 2017

It works, but you don't get sources. And I reckon it'll cause jar-hell if anything else happens to pull in dependencies provided in the plugin zip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment