The following error is occurring
So I deleted the lib in elasticsearch/lib, but if I delete it, another error occurs
If I try to delete it from the java project, a code compilation error occurs, what should I do?
gradle code
buildscript {
ext {
publishedPluginVersion = rootProject.properties['pluginVersion']
pluginVersion = rootProject.properties['pluginVersion']
elasticsearchVersion = project.properties['elasticsearchVersion']
pluginName = rootProject.properties['pluginName']
luceneVersion = project.properties['luceneVersion']
javaVersion = 17
}
}
plugins {
id 'java'
}
apply plugin: 'java'
group 'org.elasticsearch.plugin'
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
group = 'org.elasticsearch.plugin'
version = pluginVersion
def pluginFullName = pluginName + '-' + version
dependencies {
// implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.2'
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.15'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.12.0'
implementation group: 'org.elasticsearch', name: 'elasticsearch', version: "${elasticsearchVersion}"
implementation group: 'org.apache.lucene', name: 'lucene-core', version: "${luceneVersion}"
testCompileOnly group: 'junit', name: 'junit', version: '4.12'
}
test {
systemProperties 'property': 'value'
}
configurations {
includeInJar
distJars {
exclude group: 'elasticsearch'
exclude group: 'lucene-core'
}
}
task cleanOldData {
doLast {
delete 'build/tmp/' + pluginFullName
}
}
task configureElasticsearchVersion() {
doLast {
if (project.hasProperty('elasticsearchVersion')) {
elasticsearchVersion = project.properties['elasticsearchVersion']
}
}
}
task generateVersionsFile() {
outputs.upToDateWhen { false }
doFirst {
def resourcesDir = 'build/tmp/'
def contents2 = """name=${pluginName}
description=musinsa custom plugin
version=${pluginVersion}
classname=org.elasticsearch.plugin.analysis.MusinsaPlugin
elasticsearch.version=${elasticsearchVersion}
java.version=${javaVersion}"""
new File(resourcesDir, "plugin-descriptor.properties").text = contents2
}
}
task resolvePluginDescriptorTemplate(type: Copy, dependsOn: configureElasticsearchVersion) {
outputs.upToDateWhen { false }
from 'src/main/resources/'
into 'build/tmp/' + pluginFullName
expand([
'descriptor': [
'name' : pluginName,
'pluginVersion': project.properties['pluginVersion'],
'elasticsearchVersion' : project.properties['elasticsearchVersion']
]
])
}
task toJar(type: Jar, dependsOn: generateVersionsFile) {
from sourceSets.main.getOutput()
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from { configurations.runtimeClasspath.collect {
println ('it : ' + it)
it.isDirectory() ? it : zipTree(it)
}
}
with jar
}
task buildPluginZip(type: Zip, dependsOn: [cleanOldData, toJar, resolvePluginDescriptorTemplate]) {
outputs.upToDateWhen { false }
archivesBaseName = pluginName
into('.')
{
from configurations.distJars.filter {
x -> print "sdfsdfsdf : ${x}"
!x.name.contains('spatial4j') && ! x.name.contains('jts')
}
from 'build/tmp/plugin-descriptor.properties'
from 'build/libs/' + pluginFullName + '.jar'
from 'build/tmp/' + pluginFullName
}
}
//[ compileJava, compileTestJava ]*.options*.encoding = 'UTF-8'
//[ compileJava, compileTestJava ]*.options*.compilerArgs = ['-Xlint:-options']
plugin install error
-> Installing file:///Users/musinsa/Documents/search-platform-plugin/build/distributions/musinsa-analyzer-8.3.2.0.zip
-> Downloading file:///Users/musinsa/Documents/search-platform-plugin/build/distributions/musinsa-analyzer-8.3.2.0.zip
[=================================================] 100%
-> Failed installing file:///Users/musinsa/Documents/search-platform-plugin/build/distributions/musinsa-analyzer-8.3.2.0.zip
-> Rolling back file:///Users/musinsa/Documents/search-platform-plugin/build/distributions/musinsa-analyzer-8.3.2.0.zip
-> Rolled back file:///Users/musinsa/Documents/search-platform-plugin/build/distributions/musinsa-analyzer-8.3.2.0.zip
Exception in thread "main" java.lang.IllegalStateException: failed to load plugin musinsa-analyzer due to jar hell
at org.elasticsearch.plugins.PluginsUtils.checkBundleJarHell(PluginsUtils.java:267)
at org.elasticsearch.plugins.PluginsUtils.preInstallJarHellCheck(PluginsUtils.java:203)
at org.elasticsearch.plugins.cli.InstallPluginAction.jarHellCheck(InstallPluginAction.java:886)
at org.elasticsearch.plugins.cli.InstallPluginAction.loadPluginInfo(InstallPluginAction.java:863)
at org.elasticsearch.plugins.cli.InstallPluginAction.installPlugin(InstallPluginAction.java:894)
at org.elasticsearch.plugins.cli.InstallPluginAction.execute(InstallPluginAction.java:245)
at org.elasticsearch.plugins.cli.InstallPluginCommand.execute(InstallPluginCommand.java:89)
at org.elasticsearch.common.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:54)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
at org.elasticsearch.cli.MultiCommand.execute(MultiCommand.java:94)
at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:85)
at org.elasticsearch.cli.Command.main(Command.java:50)
at org.elasticsearch.launcher.CliToolLauncher.main(CliToolLauncher.java:64)
Caused by: java.lang.IllegalStateException: jar hell!
class: org.elasticsearch.Assertions
jar1: /Users/musinsa/Downloads/elasticsearch-8.3.2/lib/elasticsearch-8.3.2.jar
jar2: /Users/musinsa/Downloads/elasticsearch-8.3.2/plugins/.installing-233013255138858456/musinsa-analyzer-8.3.2.0.jar
at org.elasticsearch.jdk.JarHell.checkClass(JarHell.java:315)
at org.elasticsearch.jdk.JarHell.checkJarHell(JarHell.java:233)
at org.elasticsearch.plugins.PluginsUtils.checkBundleJarHell(PluginsUtils.java:265)
... 12 more