shade jars in plugin

Discussion in 'Plugin Development' started by crolemol, Sep 14, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    crolemol

    hey,

    I am making a huge plugin and I keep it organized so instead of import all the source of a plugin how can I just import the jar and use it in my plugin without the jar installed in the plugin folder?

    crolemol
     
  2. Offline

    mythbusterma

    crolemol

    You could indeed shade it and then set the include tag in Maven. This is strongly discouraged as it will break many plugins and causes licensing issues. Instead use the Bukkit Dependency system.
     
  3. Offline

    crolemol

    mythbusterma
    my problem is that the jar I want to use is not a plugin so I couldn't put it in the plugin folder.
    could you give me an example on how to shade it in with maven
     
  4. Offline

    mythbusterma

    crolemol

    Ah, well if it's not a plugin, and the license allows it, you should be fine. Are you already using Maven, or no? Because if you're not, there's an easier way to do it, I just assumed you were because you said "Shade."
     
  5. Offline

    crolemol

    mythbusterma
    I am using maven but what is the easier way?
     
  6. Offline

    mythbusterma

    crolemol

    If you're using Maven, you should use the Maven way, are you including it at compile time right now?
     
  7. Offline

    crolemol

    mythbusterma
    I am not including it. I don't know any way to include it. Can you give me an example for maven
     
  8. Offline

    mythbusterma

    crolemol

    Sure, the code you're including has to be hosted in a maven repository, however. Is it, and if so, where is it?
     
  9. Offline

    crolemol

    mythbusterma
    It is a h2 database driver. Yes theres a repo but i just dit include the hole jar and than export it to somewhere and executed a class from it but it doesnt work perfectly so maybe i needto shape it

    The dependency <dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.4.181</version>
    </dependency>

    Cannot find any repo but there is one because i did already found it
     
  10. Offline

    fireblast709

  11. Offline

    crolemol

    fireblast709
    Thanks very useful but I don't undetstand it. What do I have to put in include?
     
  12. Offline

    Garris0n

    groupId:artifactId

    It's also suggested that you relocate it via the configuration of the shade plugin. So that instead of having com.h2database.h2 in your jar, you'd end up with yourpackage.lib.h2database.h2. Look up maven shade plugin tutorials.
     
  13. Offline

    crolemol

    Garris0n
    ok thanks. but will I be able to run these classes (yes it are classes and not .java) or tho initialize them?
     
  14. Offline

    mythbusterma

    crolemol

    You can use them the same way you use Bukkit, I'm not sure I understand the question.
     
Thread Status:
Not open for further replies.

Share This Page