Talk:Using External Libraries with Plugins
Including pom.xml code
Maven is a complex tool, and finding the correct options in the detailed manual can be difficult. I believe that including the relevant pieces of pom.xml to load the shade plugin (or modify the classpath, etc for later section) is helpful and appropriate. Bukkit plugins run in a rather non-standard environment, and understanding the full power of the shade plugin is not necessary for getting a plugin working.
User:Mbaxter, regarding revision 8653, rather than reverting an edit completely because it is 'incomplete', please try to improve it, or at least comment on the Talk as to what your specific objections are.
- If a developer cannot find the 'Usage' page from the documentation, they really have no business using the shade plugin to begin with. Additionally, there are lots of ways to screw up and shade Bukkit or other plugins into your jar if you aren't aware of how shade works. If anything, documentation here on shade should clearly lay out what the relevant-to-bukkit elements are and how to implement it correctly instead of just copy-pasting the usage from the documentation. Additionally, explanation on the benefits of minimizeJar would be useful, as BukkitDev submissions including huge libraries without minimizeJar are likely to be have the file rejected.
- - mbaxter (talk) 06:41, 8 September 2013 (UTC)
Shade plugin and initialization from META-INF
I ran into the following problem and wished it was better documented on the wiki. However, it might be too specific for this article. I'll leave it here for the community to decide whether it's worth including as a subsection of the Shade instructions. --Quantum7 (talk) 20:45, 6 September 2013 (UTC)
Most external libraries assume that they will be loaded from their pre-built jar. Thus, occasionally a library will expect certain files and properties to be set in the META-INF directory within the jar which get used at runtime for initialization. An example is Java Advanced Imaging, which expects several properties to be set in META-INF/MANIFEST.MF and a few files in META-INF/services to be present. Since all jars contain a META-INF directory, the maven shade plugin may need some extra help in determining which files to merge in from external libraries. This is done through the use of resource transformers, which are configured in
Some libraries may also require additional initialization steps to be performed manually due to bukkit's use of a custom ClassLoader to load the plugins.