What's Changed?

You can use the Gradle Eclipse plugin and the EGit plugin (Git GUI for eclipse).

Go To Help > Eclipse Marketplace, search for ‘gradle’. The plugin is called ‘Gradle Integration for Eclipse 4.4’.

You can also install EGit using the marketplace.

To setup a project hosted on GitHub:

  1. Create a new empty repository on GitHub
  2. Open the EGit ‘Git Repositories’ view. You may have to enable it using Window > Customize Perspective...
  3. Clone your GitHub repository using the https URL
  4. Import the (empty) project using File > Import..., choose ‘Gradle Project’, select the folder of the Project (usually …/[user-folder]/git/[project-name]), click ‘Build Model’ and ‘Finish’.
  5. Create the ‘build.gradle’ file in your new project root folder

Example ‘build.gradle’:

apply plugin: 'java'
apply plugin: 'eclipse'

//java version
sourceCompatibility = 1.7

//version of your plugin
version = '1.0.0'

repositories {
    maven {
        url "http://repo.thomas15v.net/plugins" //unofficial sponge repository
    }    
}

dependencies {
    compile group: 'org.spongepowered', name: 'spongeapi', version: '1.0.0-SNAPSHOT' //adds sponge to your dependencies
}

Now you can use gradle to download your dependencies, and push the changes you made to your GitHub repository.
The first file you should place in your project root folder is a .gitignore file, so that git only uploads your source folders and not the binary folder:

1 Like