Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Gradle Effective Implementation Guide

You're reading from   Gradle Effective Implementation Guide A must-read for Java developers, this book will bring you bang up to date in the techniques of build automation using Gradle. A fully hands-on approach makes learning natural and entertaining.

Arrow left icon
Product type Paperback
Published in Oct 2012
Publisher Packt
ISBN-13 9781849518109
Length 382 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Toc

Table of Contents (20) Chapters Close

Gradle Effective Implementation Guide
Credits
About the Author
Acknowledgement
About the Reviewers
www.PacktPub.com
Preface
1. Starting with Gradle 2. Creating Gradle Build Scripts FREE CHAPTER 3. Working with Gradle Build Scripts 4. Using Gradle for Java Projects 5. Dependency Management 6. Testing, Building, and Publishing Artifacts 7. Multi-project Builds 8. Mixed Languages 9. Maintaining Code Quality 10. Writing Custom Tasks and Plugins 11. Using Gradle with Continuous Integration 12. IDE Support Index

Understanding the Gradle 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 have 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 double-clicking on them.

To start the GUI, we invoke the following command:

hello-world $ gradle --gui

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

The output of a running task is shown in the bottom part 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 tasks are shown, but we can apply a filter to show or hide certain projects and tasks. The Filter button opens a new dialog window where we can define which tasks and properties are 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 whether to execute the task, add it to the favorites, hide it (adds it to the filter), or edit the build file. If we click on Edit File, and if the .gradle extension is associated with a text editor in our operating system, the editor is opened with the content of the build script. These options can be seen in the following screenshot:

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. Alternatively, we can open the Favorites tab, click on the Add button and manually enter the project and task name we want to add to our favorites list. We can see the Add Favorite dialog window in the following screenshot:

Command Line

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

Setup

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

We learned about the different logging levels as command-line options previously in this chapter. In the GUI, we can select the logging level from the Log Level drop-down box with the different log levels. We can choose one of Debug, Info, Lifecyle, and Error as the log levels. The Error log level only shows errors and is the least verbose, while Debug is the most verbose log level. The Lifecyle log level is the default log level.

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

  • Exceptions only: For showing only exceptions when they occur; this is the default value

  • Standard Stack Trace: For showing more stack trace information for the exceptions

  • Full Stack Trace: For the most verbose stack trace information for exceptions

If we enable the option Only Show Output When Errors Occur, we get output from the build process only 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 option Use Custom Gradle Executor . 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 along with all the options we can set:

lock icon The rest of the chapter is locked
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.
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 $19.99/month. Cancel anytime
Banner background image