Я пишу плагин Spigot, где мне нужно использовать расстояние Левенштейна, поэтому я использую Apache Commons Text 1.8
Когда я экспортирую плагин и пытаюсь его запустить, я получаю NoClassDefFoundError где Я создаю экземпляр объекта LevenshteinDistance.
Я использую Gradle для настройки зависимостей.
build.gradle:
repositories {
// Use jcenter for resolving your dependencies.
// You can declare any Maven/Ivy/file repository here.
jcenter()
mavenCentral()
maven {
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
url "https://repo.dmulloy2.net/nexus/repository/public/"
}
}
dependencies {
// This dependency is exported to consumers, that is to say found on their compile classpath.
api 'org.apache.commons:commons-math3:3.6.1'
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
implementation 'com.google.guava:guava:27.0.1-jre'
// Use JUnit test framework
testImplementation 'junit:junit:4.12'
compileOnly 'org.bukkit:bukkit:1.15.2-R0.1-SNAPSHOT';
compileOnly 'com.comphenix.protocol:ProtocolLib:4.5.0';
compile 'org.apache.commons:commons-text:1.8';
}
Ошибка
[15:06:10] [Server thread/ERROR]: Error occurred while enabling CubeChat v0.1 (Is it up to date?)
java.lang.NoClassDefFoundError: org/apache/commons/text/similarity/LevenshteinDistance
at com.cubepalace.cubechat.listeners.FilterListener.<init>(FilterListener.java:30) ~[?:?]
at com.cubepalace.cubechat.CubeChat.register(CubeChat.java:71) ~[?:?]
at com.cubepalace.cubechat.CubeChat.onEnable(CubeChat.java:44) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:351) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:432) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at com.rylinaux.plugman.util.PluginUtil.load(PluginUtil.java:366) [PlugMan.jar:?]
at com.rylinaux.plugman.command.LoadCommand.execute(LoadCommand.java:114) [PlugMan.jar:?]
at com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHandler.java:95) [PlugMan.jar:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:713) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchServerCommand(CraftServer.java:698) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at net.minecraft.server.v1_15_R1.DedicatedServer.handleCommandQueue(DedicatedServer.java:443) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:407) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:984) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:824) [spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_212]
Caused by: java.lang.ClassNotFoundException: org.apache.commons.text.similarity.LevenshteinDistance
at java.net.URLClassLoader.findClass(URLClassLoader.java:382) ~[?:1.8.0_212]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:167) ~[spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:96) ~[spigot-1.15.2.jar:git-Spigot-8faa8b4-fba9f48]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_212]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_212]
... 18 more
Как мне упаковать нужную библиотеку в банку, чтобы я мог запустить это? Использование Eclipse IDE.