Gradle manifest libs


#1

Hi everyone! How can I add external libs to gradle projects?
java.lang.NoClassDefFoundError: com/jcraft/jsch/JSchException

For example, I don’t want to include JSCH and MYSQL-Connector in my artifact jar, buy I want it to be used by plugin like classpath from MANIFEST in the server root like: mods/MyLibs/jsch.jar etc.

Best regards.


#2

I don’t actually know if classpath entries in the manifest are read by sponge when loading a plugin.

This is how you add manifest entries in gradle:

jar {
    manifest {
        attributes(
            "Class-Path": "mylib.jar"
        )
    }
}

#3

Sponge doesn’t load arbitrary jars. Any code which your plugin references must be loaded in a plugin. Either include them in your plugin jar, or create a ‘library plugin’ which does and depend on it.