I am currently developing a minecraft plugin that depends on other plugins to function. Shading the other plugins into my own plugin isn't an option since it is impossible to load three different plugins from within the same jar. That's why I need to do it like this. (Another option would be to just use some kind of maven API to download my library on runtime but I have no idea how to google for that)
There is a jar file in the resources of my plugin and I copy it to the outside using Files.copy(this.class.getResourceAsStream("myjar.jar"), new File("myjar.jar").toPath()) but when I try to load it, there's an exception thrown: java.util.zip.ZipException: zip END header not found. The jar in my resources directory is fine. I'm able to unzip it. When I try to unzip the file created by my program my ark (Linux zip viewer) complains about the zip file being broken. How can I copy the file without the file breaking?
If you have any idea how I can shade a maven wrapper or something in my jar to download the other plugin from a maven repository that would be nice too. I also somewhat tried to look up how maven repositories are built to kind of reverse engineer the maven dependency function but I gave up because I don't want to write my own sucky version of maven.
Thank you for reading my question.