How to get started with Maven Eclipse | Error in pom.xml

Discussion in 'Spigot Plugin Development' started by bys1, Jun 26, 2016.

  1. I'm new to Maven. I've read a lot of tutorials, but I still don't know how to get started.

    How can I create a new Maven project in Eclipse and add Spigot API?
    How do repositories and dependencies work?
    How can I add plugin.yml, and what do I have to set as Main?
    What about exporting to a JAR?


    "Can't find plugin.yml, JAR does not contain plugin.yml"
    Have used @stoneminer02 's pom, and placed the plugin.yml in src/main/resources
    #1 bys1, Jun 26, 2016
    Last edited: Jun 28, 2016
  2. In eclipse I think it is File -> Create New... -> Project -> Maven -> Maven Project

    Don't bump within 24 hours of last reply.

    Example pom.xml
    Code (XML):

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns=""

        <groupId>ml.proximyst</groupId> <!-- Main Package can still be ml.proximyst.whatever.evenmore.Main -->
        <artifactId>HellishSurvival</artifactId> <!-- Name of project. Keep it lower case, unlike me :3 -->


            <spigot.groupId>org.spigotmc</spigot.groupId>       <!-- To switch between Bukkit & Spigot -->
            <spigot.artifactId>spigot-api</spigot.artifactId>   <!-- To switch between Bukkit & Spigot -->

            <!--Spigot API-->
    You'd just export it like normal

    Main in plugin.yml/plugin.yaml is still the same like always. src -> main -> java is the folders you have to go thru.
    Inside there you put packages. The packages you put here is your main package. My main class is then in src->main->java->ml.proximyst.hellishsurvival.Main, so I'll put in the plugin.yml as I did:
    Code (YAML):

    : HellishSurvival
    : Proximyst
    : DEV
    : HellishSurvival's custom plugin.
    : ml.proximyst.hellishsurvival.Main
    (I use the CommandMap to register commands, so ignore the fact that there are none there)

    The plugin.yml goes into src->main->resources, along with config.yml and other classes at root classpath.
    • Informative Informative x 1
  3. Thank you, could you please explain scopes and classifiers?
  4. Scope: Compile with the plugin? Is it going to be there for you? (always use provided on plugins like factions, and essentials due them being functional. API's are nice to compile)
    Classifier: Every item is classified as a library unless you say "THIS IS A JAVADOC!" or "THIS IS A SOURCES JAR!"
  5. So when I use an API like Vault or something I have to use <scope>essentials</scope>

    What is the difference between Library and source?
  6. No, not like that.
    The artifactId and groupId defines that you're using essentials.
    Scope is just to say where it is. 'provided' is that it's on the server already.
    'compile' is to put classes in the jar with it
    'runtime' is that it loads on runtime.

    Library is that it's a jar that you're using, like an external jar in build path.
    Source is the actual source of the artifact.
    Javadoc is the javadoc of the artifact.
  7. so when the system tired of finding the api file in the plugins folder it will look up to maven shade.
  8. Oops, read the sentence wrongly :confused:

    Thank you.
    • Friendly Friendly x 1
  9. No problem <3
    • Friendly Friendly x 1
  10. "Can't find plugin.yml, JAR does not contain plugin.yml"
    Have used @stoneminer02 's pom, and placed the plugin.yml in src/main/resources
  11. Are you running the maven build script (eclipse has a little green triangle button) or are you doing the old export way?

    Also scope is only needed if you are using the maven shade plugin. All dependencies are treated as provided unless otherwise specified.
  12. Show your pom?
  14. Just refresh and export
  15. ?
  16. You're not supposed to export it now that you've mavenized it. You need to run the maven build script.

  17. How can I set the name and where it is saved?