Solved External depends not working

Discussion in 'Spigot Plugin Development' started by Roimeiqui7, Apr 1, 2020.

  1. Good morning, last night I was working on connecting MongoDB to my spigot plugin.
    I've set the drivers in the build path and in pom.xml. But it's still not working.


    POM.XML
    Code (Text):
    <project xmlns="http://maven.apache.org/POM/4.0.0"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>Test1</groupId>
        <artifactId>Test1</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>Test1</name>
        <repositories>

            <repository>

                <id>spigot-repo</id>

                <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>

            </repository>

            <repository>

                <id>jitpack.io</id>

                <url>https://jitpack.io</url>

            </repository>

        </repositories>
        <dependencies>
            <dependency>

                <groupId>org.spigotmc</groupId>

                <artifactId>spigot-api</artifactId>

                <version>1.8.8-R0.1-SNAPSHOT</version>

                <scope>provided</scope>

            </dependency>
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver</artifactId>
                <version>3.9.0</version>
            </dependency>
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>bson</artifactId>
                <version>3.9.0</version>
            </dependency>
            <dependency>
                <groupId>org.mongodb</groupId>
                <artifactId>mongodb-driver-core</artifactId>
                <version>3.9.0</version>
            </dependency>
        </dependencies>

        <description>Test1</description>
    </project>

    ERROR
    Code (Text):
    [10:24:44 ERROR]: Could not load 'plugins\Test1.jar' in folder 'plugins'
    org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: org/bson/conversions/Bson
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.craftbukkit.v1_8_R3.CraftServer.loadPlugins(CraftServer.java:292) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.DedicatedServer.init(DedicatedServer.java:198) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at net.minecraft.server.v1_8_R3.MinecraftServer.run(MinecraftServer.java:525) [spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.Thread.run(Unknown Source) [?:1.8.0_241]
    Caused by: java.lang.NoClassDefFoundError: org/bson/conversions/Bson
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_241]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_241]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            ... 6 more
    Caused by: java.lang.ClassNotFoundException: org.bson.conversions.Bson
            at java.net.URLClassLoader.findClass(Unknown Source) ~[?:1.8.0_241]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:101) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.java.PluginClassLoader.findClass(PluginClassLoader.java:86) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_241]
            at java.lang.ClassLoader.loadClass(Unknown Source) ~[?:1.8.0_241]
            at java.lang.Class.forName0(Native Method) ~[?:1.8.0_241]
            at java.lang.Class.forName(Unknown Source) ~[?:1.8.0_241]
            at org.bukkit.plugin.java.PluginClassLoader.<init>(PluginClassLoader.java:64) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:131) ~[spigot-1.8.8-R0.1-SNAPSHOT-latest.jar:git-Spigot-db6de12-18fbb24]
            ... 6 more
    MY PROYECT:

    https://gyazo.com/9177c4355618f15276dfcde91e78d4fe

    Thanks for your attention.