Created
May 15, 2017 23:45
-
-
Save thelmstedt/becfa5457c42a3749d5a8519c8c5d905 to your computer and use it in GitHub Desktop.
Gradle setup for elasticsearch >= 5.x plugin dependencies
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.