Solved API doesn't work?

Discussion in 'Spigot Plugin Development' started by Didi1150, Jun 30, 2020.

  1. So, I made an api, that I uploaded to maven central. And I can add its dependency into my plugin, and use it.
    But, here comes the tricky part. When I start my Server and use an API method, it says NoClassDefError. AFter some reserch I found out, that I need my api in the plugins folder, too. Is there a way to compile my api with some kind of maven plugin into my plugin, with a single output jar?

    PS: I tried shading, but it doesn't work :(
  2. TheViperShow

    TheViperShow Previously FendiTony777

    I had this issue few minutes ago, fixed with maven shading :rolleyes:.
  3. Two options:
    1. Install the API on your server
    2. Shade the API in your final jar (Yes it does work, you are probably not doing it right google it)
  4. Can u make an example?
  5. TheViperShow

    TheViperShow Previously FendiTony777

    I actually managed to shade a system resource (THIS IS NOT RECOMMENDED) by using addjars-maven-plugin:
    This did put every JAR file inside /API-Dependency folder into my final Jar.
    • Funny Funny x 1
  6. robertlit, it doesn't work for me, still says NoClassDefError
  7. Code (Text):
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
  8. Oh I got the problem. The jar's working, but I need to connect to an MySQL database with the api. And the Api takes the data from a config.
  9. And btw, thanks for your amazing help!
  11. I know, I know, but not everyone is perfect.