Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Gradle.pdf
Скачиваний:
9
Добавлен:
24.03.2015
Размер:
1.4 Mб
Скачать

3

Tutorials

3.1. Getting Started

The following tutorials introduce some of the basics of Gradle, to help you get started.

Chapter 4, Installing Gradle

Describes how to install Gradle.

Chapter 6, Build Script Basics

Introduces the basic build script elements: projects and tasks.

Chapter 7, Java Quickstart

Shows how to start using Gradle's build-by-convention support for Java projects.

Chapter 8, Dependency Management Basics

Shows how to start using Gradle's dependency management.

Chapter 9, Groovy Quickstart

Using Gradle's build-by-convention support for Groovy projects.

Chapter 10, Web Application Quickstart

Using Gradle's build-by-convention support for Web applications.

Page 22 of 343

4

Installing Gradle

4.1. Prerequisites

Gradle requires a Java JDK to be installed. Gradle requires a JDK 1.5 or higher. Gradle ships with its own Groovy library, therefore no Groovy needs to be installed. Any existing Groovy installation is ignored by Gradle.

Gradle uses whichever JDK it finds in your path (to check, use java -version). Alternatively, you can set the JAVA_HOME environment variable to point to the install directory of the desired JDK.

4.2. Download

You can download one of the Gradle distributions from the Gradle web site.

4.3. Unpacking

The Gradle distribution comes packaged as a ZIP. The full distribution contains:

The Gradle binaries.

The user guide (HTML and PDF).

The DSL reference guide.

The API documentation (Javadoc and Groovydoc).

Extensive samples, including the examples referenced in the user guide, along with some complete and more complex builds you can use the starting point for your own build.

The binary sources. This is for reference only. If you want to build Gradle you need to download the source distribution or checkout the sources from the source repository. See the Gradle web site for details.

For Un*x users

You need a GNU compatible tool to unzip Gradle, if you want the file permissions to be

Page 23 of 343

properly set. We mention this as some zip front ends for Mac OS X don't restore the file permissions properly.

4.4. Environment variables

For running Gradle, add GRADLE_HOME/bin to your PATH environment variable. Usually, this is

sufficient to run Gradle.

4.5. Running and testing your installation

You run Gradle via the gradle command. To check if Gradle is properly installed just type gradle -v. The output shows Gradle version and also local environment configuration (groovy and jvm version, etc.). The displayed gradle version should match the distribution you have downloaded.

4.6. JVM options

JVM options for running Gradle can be set via environment variables. You can use GRADLE_OPTS or JAVA_OPTS. Those variables can be used together. JAVA_OPTS is by convention an environment variable shared by many Java applications. A typical use case would be to set the HTTP proxy in JAVA_OPTS and the memory options in GRADLE_OPTS. Those variables can also be set at the beginning of the gradle or gradlew script.

Page 24 of 343

5

Troubleshooting

This chapter is currently a work in progress.

When using Gradle (or any software package), you can run into problems. You may not understand how to use a particular feature, or you may encounter a defect. Or, you may have a general question about Gradle.

This chapter gives some advice for troubleshooting problems and explains how to get help with your problems.

5.1. Working through problems

If you are encountering problems, one of the first things to try is using the very latest release of Gradle. New versions of Gradle are released frequently with bug fixes and new features. The problem you are having may have been fixed in a new release.

If you are using the Gradle Daemon, try temporarily disabling the daemon (you can pass the command line switch --no-daemon). The Gradle Daemon is currently an experimental feature and may introduce build failures. More information about troubleshooting daemon is located in Chapter 13, The Gradle Daemon.

5.2. Getting help

The place to go for help with Gradle is http://forums.gradle.org. The Gradle Forums is the place where you can report problems and ask questions to the Gradle developers and other community members.

If something's not working for you, posting a question or problem report to the forums is the faste way to get help. It's also the place to post improvement suggestions or new ideas. Th development team frequently posts news items and announces releases via the forum, making it a great way to stay up to date with the latest Gradle developments.

Page 25 of 343

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]