Gradle is a great java build automation tool, you can do everything from the command line, but an IDE surely helps a lot. An IDE plugin allows you interactive with Gradle in GUI interface, edit build script and Java source file in one place, execute task and run build by pressing a button. This post shows you how to let Gradle project works in Eclipse, how to import Gradle project into Eclipse and build it in Eclipse.
STEP 1. Install Gradle plugin for Eclipse
The best way to use Gradle inside Eclipse is install the Gradle plugin, this plugin add new options to Create Project, Import Project and project popup menus, allows you to create, import , debug and build Gradle Project in Eclipse.
Select Help - Install New Softare... and paste the following url
One problem you may run into is wait too long when downloading from dist.springsource.com. The other way is to install Gradle plugin from Eclipse Marketplace. Select Help - Eclipse Marketplace and search for "Gradle", find GradleIDE and install.
After that, you will see Gradle Project option in New Project wizard:
STEP 2. Import Gradle project
After installed Eclipse Gradle plugin, import gradle project is easy, let's see an example, checkout the org hibernate project from github
git clone https://github.com/hibernate/hibernate-orm.git
Its a Gradle project, to import the Gradle project into Eclipse, select File - Import and choose Gradle Project
Click Build Model will import the Gradle project as Eclipse project.
STEP 3. Build in Eclipse
After import, you can build the project, there are two methods to build, select Run As - Gradle Build, and select tasks to build,
Or Gradle - Task Quick Launcher