This article describes how to use the Gradle tooling in Eclipse.

1. Eclipse Gradle support

Gradle Inc., the company behind the Gradle build framework provides Gradle tooling for the Eclipse IDE. This tooling allows to create and import Gradle enabled projects into the Eclipse IDE. It also allows to run Gradle tasks and monitor it execution.

The Eclipse project itself is called Buildship. It is available on Buildship on Github.

2. Install Eclipse Gradle (Buildship) tooling

2.1. Installation via the Marketplace

The easiest way to install the Eclipse Gradle tooling is by using the Marketplace client. Search for Buildship.

Eclipse Gradle installation via the Marketplace

2.2. Installation via the Eclipse update manager

You also can use the Help  Install New Software menu path to install the Gradle tooling.

For example, the following URLs are available for the different Eclipse releases:

Eclipse Gradle installation via the update manager

The Eclipse Gradle project provides also other updates sites, e.g., for developer builds. See the Buildship download page for details:

3. Creating Gradle projects

3.1. Creating standard Java projects

The Eclipse Gradle tooling provides a wizard for the creation of Java based Gradle projects. You can reach it via the File  New  Other…​ menu entry.

New Gradle project wizard

Click on the Next > button.

New Gradle project configuration page

Press the Finish button to create the project. This triggers the gradle init --type java-library command and imports the project. Press the Next > button to get a preview of the configuration before the projects created.

New Gradle project preview page

The created project looks similar to the following screenshot.

New Gradle project wizard result

3.2. Creating web applications

The following demonstrates how to create a Spring Boot webapplication with Gradle.

First, create a standard Gradle project called com.vogella.springboot.gradle.minimal.

Change the build.gradle file to the following:

buildscript {
    ext {
        springBootVersion = '1.5.3.RELEASE'
    repositories {
    dependencies {

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'com.vogella.springboot'
    version = '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8

repositories {

dependencies {



Ensure you update the project classpath, see Updating the Java class path via Gradle for details.

Create the following class.

package com.vogella.springboot.gradle.minimal;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

public class Application {

    public static void main(String[] args) {, args);


Select this class, and select via the context menu Run-As  Java Application.

This starts String Boot and the selected application on http://localhost:8080.

To learn more about Spring Boot, see the Spring tutorial.

4. Import an existing Gradle project

You can also import existing Gradle projects into Eclipse. Select the File  Import…​  Gradle  Gradle Project menu entry for this.

Gradle import wizard

After pressing the Next > button, you need to specify the root directory of your Gradle project.

Import Gradle project

You may now press Finish button and use the default settings for the import or press the Next button and specify the Gradle runtime settings.

Import Gradle project

Afterwards the import preview is shown.

Import Gradle project review

5. Updating the Gradle tooling

5.1. Using the Gradle Tasks view

The Gradle Tasks view shows the available Gradle tasks for your projects.

The Gradle task view

Via the context menu you can run a selected Gradle task.

Run Gradle task

By default, the result is displayed in the Gradle Executions view. It is also displayed in the Console view. This is similar to the output you would get if you run the task via the command line.

5.2. Updating classpath with the latest changes in the build file

Eclipse does not automatically update the classpath, if the build.gradle file is updated. Select Gradle  Refresh Gradle Project from the context menu of the project or from your build.gradle file for that.

Refresh Gradle buildpath in Eclipse

You can also activate the auto synchronization for changes in the build files.

gradle autosync eclipse

5.3. Add Gradle support to existing Eclipse project

To convert a Java project to use Gradle, select Gradle  Add Gradle Nature from the context menu of the project.


Run the 'gradle init' task to create the initial Gradle files, in case you do not have them yet.

6. Annotation processing (apt) with Gradle in Eclipse

6.1. Overview

The gradle-apt-plugin supports annotation processing for Gradle. It also supports using this in Eclipse and IntelliJ.

6.2. Setup in the Eclipse IDE

The following example describes it usage using the to automatically generate builders for your data model.

Adjust your build.gradle to enable the gradle-apt-plugin.

buildscript {
  repositories {
    maven {
      url ""
  dependencies {
    classpath "net.ltgt.gradle:gradle-apt-plugin:0.13"

apply plugin: "net.ltgt.apt-eclipse"
apply plugin: 'java-library'

repositories {
    // Use jcenter for resolving your dependencies.
    // You can declare any Maven/Ivy/file repository here.

dependencies {
    // Use JUnit test framework
    testImplementation 'junit:junit:4.12'

6.3. Example: Using Auto-value with apt-processing

The following demonstrates the usage of the Auto value apt-processor in a Java project.

dependencies {
  // more stuff

  // auto-factory contains both annotations and their processor, neither is needed at runtime
  compileOnly ""
  apt         ""

Afterwards run the eclipse task. This configures apt-processing within the Eclipse IDE.


abstract class Task {
    static Task create(String summary, String description, int duration) {
        // See "How do I...?" below for nested classes.
        return new AutoValue_Task(summary, description, duration); // generated by the apt processor

      abstract String summary();
      abstract String description();
      abstract int duration();


Using it:

import org.junit.Test;
import static org.junit.Assert.*;

public class TaskTest {
    @Test public void testSomeLibraryMethod() {
        Task create = Task.create("Learn apt", "Now", 10);


7. Android support

To compile Android projects with the Eclipse IDE, you can use gradle-android-eclipse plug-in from Afterwards the Android project should compile in the Eclipse IDE and you can run the Gradle tasks via the Gradle Task view.

8. Contribute to the buildship project

After you installed the Buildship tooling, you can help the project by reporting issues in the Gradle Forum or by contributing code.

8.1. Reporting bugs and feature requests

To help the Buildship project, please report all issues with the tooling via: New Bug report for Buildship You can report bugs or feature requests.

8.2. Get the source code

Since the project is hosted on Github, you can obtain the source by cloning it from the following URL:

The project also provides a Oomph setup for the development, which is explained further in the Buildship Docs.

9. Eclipse Gradle (Buildship) resources

10. vogella training and consulting support

Copyright © 2012-2019 vogella GmbH. Free use of the software examples is granted under the terms of the Eclipse Public License 2.0. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.