GitHub / Maven howto

Discussion in 'Resources' started by petteyg359, Apr 5, 2011.

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


    Copying my post from an apparently non-public forum so that everyone can read it :)

    How to use git:
    Create an account on GitHub. Create a repository using the name of your project. On Windows, install MSYSGIT. On Linux, use your package manager to install git. Open up a [msysgit-]bash prompt, cd to your project folder, and:
    git init
    git remote add origin
    git add SRC
    git commit -m "Commit message goes here!"
    git push -u origin
    Where SRC is your source files. If they're all in a directory named "src" (If they aren't you should learn Maven (also CLI-based). It makes building jars so much quicker :)).
    For future updates:
    git add SRC
    git commit -m "Updated updates with an updating updater of updatedness!"
    git push
    You only have to use "-u origin" on the very first push. After that, it knows where you're pushing to.

    How to use Maven:
    Eclipse and IDEA should be able to automatically load Maven projects if they're in the right format. Use the following layout:
    You can use some other layout for the package (com/yourname) if you actually own a domain name, but DO NOT USE com, net, or org/bukkit (or com, net, or org.bukkit in your java file).
    In pom.xml, put the following:
    <project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <!-- You don't necessarily need to depend on Permissions if you don't want to, but this is how you add a dependency -->
    You need to download maven from You might need to add whatever folder you put it in to your PATH. In Windows, see this page. Just add ";whereveryouextractedthezipto/bin" to the end. If there's already a semi-colon on the end, then you don't need to add another. In Linux, just install maven (or maven-bin) from your package manager.
    To install Bukkit so that Maven can find them, download the jars, then use the following command:
    mvn install:install-file -Dfile=whereveryoudownloadedbukkit-0.0.1-SNAPSHOT.jar -DgroupId=com.bukkit -DartifactId=bukkit -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar
    The same command can be modified slightly to install any other jar you depend on. For Permissions:
    mvn install:install-file -Dfile=whereveryoudownloadedPermissions-2.5.5.jar -DgroupId=com.nijikokun -DartifactId=Permissions -Dversion=2.5.5 -Dpackaging=jar
    Replace file, groupId, artifactId, and version as needed, just make sure you use the right strings.

    Of course, if they've released the source (and have a decent pom.xml, which some do not (/me wags finger at GroupManager)), you can just download it and use 'mvn install' to compile it yourself.

    Then, you can just cd into your project directory and type "mvn install" and it will build your jar with all dependencies, and you can copy it from the repository to your plugins folder.
    GarethNZ, compwhizii and rakiru like this.
  2. Offline

    Daniel Heppner

    Is there a way so that Maven automagically downloads the dependencies? I've seen it done with CommandBook. It made it so easy to compile, just type a command. Also, I saw something in CommandBook's pom.xml about GitHub, and I'm wondering if that lets you have it automatically upload to GitHub. That would be so awesome, thanks for the tutorial. :)
  3. Offline


    You can add repositories for it to search for dependencies:
    Just add as many repository sections inside <repositories /> as needed, with each having a unique id.
  4. Offline


    There's the bukkit repo,, but since they all have the same version it doesn't seem to work.
    Can I somehow force maven to always download the newest?
    Or download the one with a specific build.number in the metadata?
  5. Offline


    The Bukkit repository URL I've seen used is
    I'm not sure how maven deals with the version string remaining the same. I just keep a fork of Bukkit.git and build my own bukkit.jar from that.
  6. Offline


    Ah, seems so easy lol.

    Cheers for this - will update my GitHub later today :p
  7. Offline


    What repo do i need to add for Permissions 3.x?
  8. Offline


    You just use sk89q's dummypermissions to compile. The WorldEdit pom.xml file has an excellent example of this. It really doesn't matter what version of Permissions you use to compile it, as long as it has the same API.
  9. Offline


    So there is no offcial. Using bukkit's now anyway.
  10. Offline


    So do I just install the source code inside the folder my repository is located in, then execute the commands in the [.code] tag? I'm confused a little bit.
Thread Status:
Not open for further replies.

Share This Page