Is there a less verbose way to bundle a library with an additional jar?

24 Views Asked by At

I've been developing a plugin that includes a feature of saving people's alt accounts in a database. I want it to be secure, so I decided to use the same hashing algorithm/library I used in my javascript projects, BCrypt. I included jBCrypt in my pom.xml like this:

    <dependencies>
        ...
        <dependency>
            <groupId>org.mindrot</groupId>
            <artifactId>jbcrypt</artifactId>
            <version>0.4</version>
        </dependency>
    </dependencies>

And it compiles successfully when running the install lifecycle within IntelliJ IDEA. However, after facing the java.lang.NoClassDefFoundError: org/mindrot/jbcrypt/BCrypt error (full error)

If there is any solution to this, please let me know.

I tried to solve it by googling it, deleting my local maven repo, asking ChatGPT, restarting my server, my IDE and even my PC. I later unzipped the .jar and found that it was not including ANY classes from dependencies. This was never an issue because all of my dependencies like database drivers etc. were already included in the spigot.jar.

EDIT: Using the maven-shade-plugin/maven-assembly-plugin solves this, but the solution seems verbose to me. Is there a less verbose way e.g. not having to specify the class path?

0

There are 0 best solutions below