# Gradle2.0用户指南翻译——第十二章. 使用Gradle 图形用户界面

https://github.com/msdx/gradledoc

https://github.com/msdx/gradledoc/tree/2.0 。

http://gradledoc.qiniudn.com/2.0/userguide/userguide.html 。

https://github.com/msdx/gradle-doc-apk

http://blog.csdn.net/maosidiaoxian/article/details/78840754

# 第十二章. 使用Gradle 图形用户界面

### Chapter 12. Using the Gradle Graphical User Interface

In addition to supporting a traditional command line interface, Gradle offers a graphical user interface. This is a stand alone user interface that can be launched with the --gui option.

gradle --gui

Note that this command blocks until the Gradle GUI is closed. Under *nix it is probably preferable to run this as a background task (gradle --gui&)

If you run this from your Gradle project working directory, you should see a tree of tasks.

It is preferable to run this command from your Gradle project directory so that the settings of the UI will be stored in your project directory. However, you can run it then change the working directory via the Setup tab in the UI.

The UI displays 4 tabs along the top and an output window along the bottom.

## 12.1. 任务树

#### 12.1. Task Tree

The Task Tree shows a hierarchical display of all projects and their tasks. Double clicking a task executes it.

There is also a filter so that uncommon tasks can be hidden. You can toggle the filter via the Filter button. Editing the filter allows you to configure which tasks and projects are shown. Hidden tasks show up in red. Note: newly created tasks will show up by default (versus being hidden by default).

The Task Tree context menu provides the following options:

• 执行忽略的依赖。它不需要所依赖的项目重新构建（与-a选项一样）。

Execute ignoring dependencies. This does not require dependent projects to be rebuilt (same as the -a option).

• 将任务添加到收藏夹（见收藏夹Favorites选项卡）

Add tasks to the favorites (see Favorites tab)

• 隐藏所选择的任务。这将会把它们添加到过滤器中。

Hide the selected tasks. This adds them to the filter.

• 编辑build.gradle文件。注意：这需要Java 1.6或更高的版本，并且要求你的操作系统关联了.gradle文件。

Edit the build.gradle file. Note: this requires Java 1.6 or higher and requires that you have .gradle files associated in your OS.

## 12.2. 收藏夹

#### 12.2. Favorites

“收藏夹”选项卡用于存储常用的命令。这些命令可以是复杂的命令（只要它们符合Gradle命令），你可以给它们设置一个显示名称。这有助于创建一个自定义构建命令，来显式地跳过测试，文档和示例，你可以称之为“快速构建”。
The Favorites tab is place to store commonly-executed commands. These can be complex commands (anything that's legal to Gradle) and you can provide them with a display name. This is useful for creating, say, a custom build command that explicitly skips tests, documentation, and samples that you could call "fast build".

You can reorder favorites to your liking and even export them to disk so they can imported by others. If you edit them, you are given options to "Always Show Live Output." This only applies if you have 'Only Show Output When Errors Occur'. This override always forces the output to be shown.

## 12.3. 命令行

#### 12.3. Command Line

The Command Line tab is place to execute a single Gradle command directly. Just enter whatever you would normally enter after 'gradle' on the command line. This also provides a place to try out commands before adding them to favorites.

## 12.4. 设置

#### 12.4. Setup

The Setup tab allows configuration of some general settings.

• 当前目录

定义了 Gradle 项目的根目录（通常是 build.gradle 所在的位置）。

Current Directory

Defines the root directory of your Gradle project (typically where build.gradle is located).

• 堆栈跟踪输出

这决定了错误发生出时，有多少信息会写到堆栈跟踪。注意：如果你在命令行或收藏夹选项卡上指定了堆栈跟踪级别，将会覆盖这里的堆栈跟踪级别。

Stack Trace Output

This determines how much information to write out stack traces when errors occur. Note: if you specify a stack trace level on either the Command Line or Favorites tab, it will override this stack trace level.

• 只在出现错误时显示输出

启用此选项后，除非构建失败，否则将在任务执行时隐藏任何输出。

Only Show Output When Errors Occur

Enabling this option hides any output when a task is executed unless the build fails.

• 使用自定义的 Gradle 执行器 - 高级功能

它为你提供了启动Gradle命令的替代方式。如果你的项目需要在另一个批处理文件或 shell 脚本中做一些额外的配置（比如指定一个初始化脚本），这将会非常有用。

Use Custom Gradle Executor - Advanced feature

This provides you with an alternate way to launch Gradle commands. This is useful if your project requires some extra setup that is done inside another batch file or shell script (such as specifying an init script).

+ 订阅