1.16.5 How to use a Maven library from git repo in Eclipse

Discussion in 'Spigot Plugin Development' started by Snicko, May 10, 2021.

  1. Hey there!
    I have stumbled upon the free resource AnvilGUI (https://github.com/WesJD/AnvilGUI).
    I would love to use this in my plugin although I have absolutely no clue how I'm supposed to reference the project. I've never used Maven before so I'm a bit clueless and was hoping if someone could point me in the right direction as it's quite overwhelming for just wanting to reference this code.

    I have imported the project into my Eclipse by cloning the repo and have also converted my own project into a Maven project (is that right?).

    [​IMG]
     
  2. you can't use the plugin's API in maven unless they have a maven repo set up.
    alternatively, you could try JitPack out.

    also you should really stop using eclipse and switch to intellij as that is straight-up bad practice.
     
  3. On their github they have mentioned it requires maven:

    [​IMG]

    I have never used Maven so I just assumed I needed it to use the code?
     
  4. look up a maven tutorial.
     
  5. You add the dependency part into your <dependencies> section of your pom.xml and the repository into the <repositories> section. See, for example, the pom.xml for my AngelChest plugin:
    https://github.com/JEFF-Media-GbR/Spigot-AngelChestPlus/blob/master/pom.xml