Using External Libraries with Plugins
In order to use external libraries in Bukkit plugins, the server must have the required libraries on the classpath. There are several method available that plugins can use to get their libraries onto the classpath.
Shade the external libraries into the plugin’s jar
A plugin can copy the dependencies into the jar, this can be done with maven-shade-plugin. Plugins should relocate their dependencies to avoid conflicts between plugins, which may result in
nausea, vomiting, upset stomach, and/or death unintended behavior or exceptions. Additional information about the maven-shade-plugin can be found at http://maven.apache.org/plugins/maven-shade-plugin/
Declaring a class-path attribute in the manifest
A plugin can declare a class-path attribute in the jar’s manifest. The classpath is relative to the jar itself, and not where the jvm was invoked from. Plugins should not make any assumptions as to the location of the plugins folder, and cannot be placed in the root of the plugin folder. The entry can be made with the maven-jar-plugin, but is not required to be made. Additional information about the maven-jar-plugin can be found at http://maven.apache.org/plugins/maven-jar-plugin/
For example, class-path
./lib/example.jar declares that example.jar is in the lib directory in the plugins folder. The plugins folder itself however, can be defined as a command line argument to CraftBukkit.
Instruct the classloader to load more jars
A plugin can have their classloader load additional jars.
Append the classpath
Additional jars can be added to the classpath for the jvm with the -cp flag or changing the CLASSPATH environment variable. This is something the plugin itself should not do and must be completed at the discretion of the server administrator. Additional information can be found at http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html