This article describes how to use the Gradle tooling in Eclipse.
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.
The easiest way to install the Eclipse Gradle tooling is by using the Marketplace client. Search for Buildship.
You also can use themenu path to install the Gradle tooling.
For example, the following URL can be used for the Eclipse 4.6 (Neon) release: http://download.eclipse.org/releases/neon
The Eclipse Gradle project provides also other updates sites, e.g., for developer builds. See the Buildship download page for details: https://projects.eclipse.org/projects/tools.buildship/downloads
The Eclipse Gradle tooling provides a wizard for the creation of Java based Gradle projects. You can reach it via themenu entry.
Click on the Next > button.
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.
The created project looks similar to the following screenshot.
You can also import existing Gradle projects into Eclipse. Select themenu entry for this.
After pressing the Next > button, you need to specify the root directory of your 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.
Afterwards the import preview is shown.
Eclipse does not automatically update the classpath, if the
build.gradle file is updated.
Select from the context menu of the project or from your build.gradle file for that.
To convert a Java project to use Gradle, selectfrom 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.
After successfully importing a Gradle project, the project is shown in the Gradle Tasks view.
By right clicking on a certain Gradle task in the Gradle Tasks view, you can run the selected Gradle task.
By default the result is displayed in the Gradle Executions view. It is also displayed in the Console view similar to the output you would get if you run the task via the command line.
The Gradle Executions view can only be used, if you use Gradle 2.4 or higher.
Currently the Buildship tooling does not support setting up the classpath for Android project. But you can already import Android projects into Eclipse and run the Gradle tasks via the Gradle Task view.
After you installed the Buildship tooling, you can help the project by reporting issues in the Gradle Forum or by contributing code.
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.
|TRAINING||SERVICE & SUPPORT|
The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.
The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.
Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.