Reader small image

You're reading from  Gradle Effective Implementations Guide - Second Edition

Product typeBook
Published inMay 2016
Reading LevelIntermediate
Publisher
ISBN-139781784394974
Edition2nd Edition
Languages
Tools
Right arrow
Author (1)
Hubert Klein Ikkink
Hubert Klein Ikkink
author image
Hubert Klein Ikkink

Hubert Klein Ikkink was born in 1973 and lives in Tilburg, the Netherlands, with his beautiful wife and gorgeous children. He is also known as mrhaki, which is simply the initials of his name prepended by mr. He studied Information Systems and Management at the Tilburg University. After finishing his studies he started to work at a company which specialized in knowledge-based software. There he started writing his first Java software (yes, an applet!) in 1996. Over the years his focus switched from applets, to servlets, to Java Enterprise Edition applications, to Spring-based software. In 2008 he wanted to have fun again when writing software. The larger projects he was working on were more about writing configuration XML files, tuning performance and less about real development in his eyes. So he started to look around and noticed Groovy as a good language to learn about. He could still use existing Java code, libraries, and his Groovy classes in Java. The learning curve isn’t steep and to support his learning phase he wrote down interesting Groovy facts in his blog with the title Groovy Goodness. He posts small articles with a lot of code samples to understand how to use Groovy. Since November 2011 he is also a DZone Most Valuable Blogger (MVB); DZone also posts his blog items on their site. In 2010, 2011, and 2012 Hubert was invited to speak at Gr8Conf in Copenhagen, Denmark. This is a very good conference with all the project leaders of Groovy and Groovy-related projects. In November 2010 he presented a Gradle talk at the J-Fall conference of the Dutch Java User Group. In November 2011 he presented about the new features in Groovy 1.8 at the same conference. The conference is visited by 1000 Java developers and he got the chance to educate some of them about the greatness of Gradle and Groovy. Hubert works for a company called JDriven in the Netherlands. JDriven focuses on technologies that simplify and improve development of enterprise applications. Employees of JDriven have years of experience with Java and related technologies and are all eager to learn about new technologies. Hubert works on projects using Grails and Java combined with Groovy and Gradle.
Read more about Hubert Klein Ikkink

Right arrow

Understanding the Gradle graphical user interface


Finally, we take a look at the --gui command-line option. With this option, we start a graphical shell for our Gradle builds. Until now, we used the command line to start a task. With the Gradle GUI, we have a graphical overview of the tasks in a project and we can execute them by simply clicking on the mouse.

To start the GUI, we invoke the following command:

$ gradle --gui

A window is opened with a graphical overview of our task tree. We only have one task that one is shown in the task tree, as we can seen in the following screenshot:

Overview of tasks in the Gradle GUI

The output of running a task is shown at the bottom of the window. When we start the GUI for the first time, the tasks task is executed and we see the output in the window.

Task tree

The Task Tree tab shows projects and tasks found in our build project. We can execute a task by double-clicking on the task name.

By default, all the tasks are shown, but we can apply a filter to show or hide certain projects and tasks. The Edit filter button opens a new dialog window where we can define the tasks and properties that are a part of the filter. The Toggle filter button makes the filter active or inactive.

We can also right-click on the project and task names. This opens a context menu where we can choose to execute the task, add it to the favorites, hide it (adds it to the filter), or edit the build file. If we have associated the .gradle extension to a text editor in our operating system, then the editor is opened with the content of the build script. These options can be seen in the following screenshot:

Available actions for a task in the Gradle GUI

Favorites

The Favorites tab stores tasks we want to execute regularly. We can add a task by right-clicking on the task in the Task Tree tab and selecting the Add To Favorites menu option, or if we have opened the Favorites tab, we can select the Add button and manually enter the project and task name that we want to add to our favorites list. We can see the Add Favorite dialog window in the following screenshot:

Add favorites in the Gradle GUI

Command line

On the Command Line tab, we can enter any Gradle command that we normally would enter on the command prompt. The command can be added to Favorites as well. We see the Command Line tab contents in the following image:

Execute task with command-line optins

Setup

The last tab is the Setup tab. Here, we can change the project directory, which is set to the current directory by default.

We discussed about the different logging levels as command-line options previously in this chapter. With the GUI, we can select the logging level from the Log Level select box with the different log levels. We can choose debuginfoLifecycle, and error as log levels. The error log level only shows errors and is the least verbose, while debug is the most verbose log level. The lifecycle log level is the default log level.

Here, we also can set how detailed the exeption stack trace information should be. In the Stack Trace Output section, we can choose from the following three options:

  • Exceptions Only: This is for only showing the exceptions when they occur, which is the default value

  • Standard Stack Trace (-s): This is for showing more stack trace information for the exceptions

  • -S): This is for the most verbose stack trace information for exceptions

If we enable the Only Show Output When Error Occurs option, then we only get output from the build process if the build fails. Otherwise, we don't get any output.

Finally, we can define a different way to start Gradle for the build with the Use Custom Gradle Executor option. For example, we can define a different batch or script file with extra setup information to run the build process. The following screenshot shows the Setup tab page and all the options that we can set:

Setup Gradle options in the Gradle GUI

Previous PageNext Page
You have been reading a chapter from
Gradle Effective Implementations Guide - Second Edition
Published in: May 2016Publisher: ISBN-13: 9781784394974
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Hubert Klein Ikkink

Hubert Klein Ikkink was born in 1973 and lives in Tilburg, the Netherlands, with his beautiful wife and gorgeous children. He is also known as mrhaki, which is simply the initials of his name prepended by mr. He studied Information Systems and Management at the Tilburg University. After finishing his studies he started to work at a company which specialized in knowledge-based software. There he started writing his first Java software (yes, an applet!) in 1996. Over the years his focus switched from applets, to servlets, to Java Enterprise Edition applications, to Spring-based software. In 2008 he wanted to have fun again when writing software. The larger projects he was working on were more about writing configuration XML files, tuning performance and less about real development in his eyes. So he started to look around and noticed Groovy as a good language to learn about. He could still use existing Java code, libraries, and his Groovy classes in Java. The learning curve isn’t steep and to support his learning phase he wrote down interesting Groovy facts in his blog with the title Groovy Goodness. He posts small articles with a lot of code samples to understand how to use Groovy. Since November 2011 he is also a DZone Most Valuable Blogger (MVB); DZone also posts his blog items on their site. In 2010, 2011, and 2012 Hubert was invited to speak at Gr8Conf in Copenhagen, Denmark. This is a very good conference with all the project leaders of Groovy and Groovy-related projects. In November 2010 he presented a Gradle talk at the J-Fall conference of the Dutch Java User Group. In November 2011 he presented about the new features in Groovy 1.8 at the same conference. The conference is visited by 1000 Java developers and he got the chance to educate some of them about the greatness of Gradle and Groovy. Hubert works for a company called JDriven in the Netherlands. JDriven focuses on technologies that simplify and improve development of enterprise applications. Employees of JDriven have years of experience with Java and related technologies and are all eager to learn about new technologies. Hubert works on projects using Grails and Java combined with Groovy and Gradle.
Read more about Hubert Klein Ikkink