Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launching Gradle builds from Eclipse

Tags:

eclipse

gradle

We're looking at converting our Ant build to Gradle.

In regards to integration with Eclipse, we are looking for (conceptually) equivalent functionality for launching builds from the IDE. Eclipse provides a nice Ant view for invoking Ant targets.

There is an Eclipse plugin for launching Gradle builds (http://www.breskeby.com/downloads/gradle/eclipse/update/), but this seems to require users to jump through hoops to invoke different targets (edit the launch configuration, etc.).

How are others using Gradle from inside Eclipse?

like image 945
csl Avatar asked Jun 22 '11 15:06

csl


People also ask

How do I launch build Gradle?

From the main menu, select Run | Edit Configurations to open the run/debug configuration for your project. icon. In the list that opens, select Run Gradle task. In the Select Gradle Task dialog, specify the project and the task that you want to execute before launching the project.

How do I open Gradle tasks in Eclipse?

In gradle tasks tab -> navigate to the project -> expand build folder -> right click on build -> Select Run Gradle tasks.

Does Eclipse work with Gradle?

Buildship is an Eclipse plugin that allows you to build applications and libraries using Gradle through your IDE.

How do I know if Gradle is installed in Eclipse?

1 Answer. Show activity on this post. Select 'Help > About Eclipse' (on Macs this is 'Eclipse > About Eclipse'). Click the 'Installation Details' button to display the installation details dialog.


2 Answers

This is kind of an old post, but the SpringSource STS team has released a plugin: http://static.springsource.org/sts/docs/latest/reference/html/gradle/

Installation instructions can be found here: http://static.springsource.org/sts/docs/latest/reference/html/gradle/installation.html

My experience has been pretty positive with it so far. For straight-up Java projects it works quite well. I am having some issues generating correct war files through Eclipse, while using the Gradle plugin, but gradle itself does it wonderfully. I am relatively new to gradle and the plugin though, so it could be something that I am missing.

like image 120
Keith P Avatar answered Sep 19 '22 17:09

Keith P


Interim work-around more palatable to those with command-line phobia.

From Eclipse, use pulldown menu Run / External Tools / External Tools Configurations...

Select "Program" in left navigator panel then click the "New launch configuration" button in the tool bar (first button in my tool bar).

With Main tab selected, fill out the following fields:

  1. Name: (above the tabs) to "Gradle" (or whatever name you want for the launcher).
  2. Location: Use "Browse File System..." button to navigate to your "gradle.bat" or "gradlew.bat" to run.
  3. Working Directory: Use "Browse Workspace..." button to select directory with the "build.gradle" file for the desired project.
  4. Arguments: Enter "--gui"

Add to Arguments: the switch "-b filename.gradle" if you use a Gradle build file other than "build.gradle".

After this, your developers can use the Run / External Tools or tool bar button to launch the Gradle Gui. They can do this and close it after each use, or (to avoid startup lag), minimize it when not in use.

like image 33
Blaine Avatar answered Sep 17 '22 17:09

Blaine