Solved Ship a plugin jar which includes a library plugin

Discussion in 'Spigot Plugin Development' started by B1acksheep, Jul 3, 2016.

  1. Hey,
    Does anyone know a way to create a plugin jar containing the library plugin.
    So that the library plugin can also be loaded by the server?

    I personally (from a Server-Admin view) think it is a bit annoying to download (and maintain) additional libraries for a new plugin.
    Library plugins are supposed to support developers. The user must therefore not necessarily come into contact.
    • Creative Creative x 1
  2. With maven that is pretty easy. Just include the maven shade plugin into your build and the library gets shaded into the final jar.

    You can also accomplish that by changing the export settings in your IDE. I know in IntelliJ it was kind of easy.

    Also you can do this manually by opening both jars with your favourite compression tool(winrar, 7zip) and copy the contents of the one jar into the other.

    However it gets complicated when the other plugin/api is a standalone plugin(has a plugin.yml). Because then you have two classes extending JavaPlugin in one jar and it just gets messy. When this is the case, give up.

    But keep in mind that it may produce problems when there are two plugins with two duplicates of the same library. It's always better to let the user install the library themselves because then no strange bugs may happen. (Imagine two plugins using one library but different versions shaded into the jars)

    Gesendet von meinem Nexus 5 mit Tapatalk
    • Like Like x 1
  3. Thank you, i'll give it a try!

    I think to manage different versions could really be a problem.
    But it should be no problem Permanently, I'll do some testing. :)
  4. Are you looking to do this for your own stuff, or modify existing plugins?
  5. Depends fully on the dependency plugin's type. Some require to be loaded as separate plugin, others not.
    I suggest that server owners also have to do that simple work of downloading 1 or 2 files more.
    Also if the plugins are separated, any new bugfix from the dependency plugin can be immediately.
    And the most important part is about the legality. Some plugin's licenses may be incompatible to your plugin's license.
  6. I am part of a developer team for a server.
    Everything we develop is primarily for the server.
    The primary base is a Library plugin which treats UUIDs, messages and command structures. The thing has become quite powerful ^^

    I play now with the idea to offer a few of these plugins also here.
    Therefore, the consideration to include the library.