Gradle User Guide
Version 4.0.2
Copyright © 2007-2017 Hans Dockter, Adam Murdoch
Copies of this document may be made for your own use and for distribution to others, provided that you do not
charge any fee for such copies and further provided that each copy contains this Copyright Notice, whether
distributed in print or electronically.
Table of Contents
I. ABOUT GRADLE
1. Introduction
2. Overview
II. WORKING WITH EXISTING BUILDS
3. Installing Gradle
4. Using the Gradle Command-Line
5. The Gradle Console
6. The Gradle Wrapper
7. The Gradle Daemon
8. Dependency Management Basics
9. Introduction to multi-project builds
10. Continuous build
11. Composite builds
12. The Build Environment
13. Troubleshooting
14. Embedding Gradle using the Tooling API
15. Build Cache
III. WRITING GRADLE BUILD SCRIPTS
16. Build Script Basics
17. Build Init Plugin
18. Writing Build Scripts
19. More about Tasks
20. Working With Files
21. Using Ant from Gradle
22. The Build Lifecycle
23. Wrapper Plugin
24. Logging
25. Dependency Management
26. Multi-project Builds
27. Gradle Plugins
28. Standard Gradle plugins
29. The Project Report Plugin
30. The Build Dashboard Plugin
31. Comparing Builds
32. Publishing artifacts
33. The Maven Plugin
34. The Signing Plugin
35. Ivy Publishing (new)
36. Maven Publishing (new)
37. The Distribution Plugin
38. The Announce Plugin
39. The Build Announcements Plugin
IV. EXTENDING THE BUILD
40. Writing Custom Task Classes
41. Writing Custom Plugins
42. The Java Gradle Plugin Development Plugin
43. Organizing Build Logic
44. Initialization Scripts
45. The Gradle TestKit
V. BUILDING JVM PROJECTS
46. Java Quickstart
47. The Java Plugin
48. The Java Library Plugin
49. Web Application Quickstart
50. The War Plugin
51. The Ear Plugin
52. The Application Plugin
53. The Java Library Distribution Plugin
54. Groovy Quickstart
55. The Groovy Plugin
56. The Scala Plugin
57. The ANTLR Plugin
58. The Checkstyle Plugin
59. The CodeNarc Plugin
60. The FindBugs Plugin
61. The JDepend Plugin
62. The PMD Plugin
63. The JaCoCo Plugin
64. The OSGi Plugin
65. The Eclipse Plugins
66. The IDEA Plugin
VI. THE SOFTWARE MODEL
67. Rule based model configuration
68. Software model concepts
69. Implementing model rules in a plugin
70. Building Java Libraries
71. Building Play applications
72. Building native software
73. Extending the software model
VII. APPENDIX
A. Gradle Samples
B. Potential Traps
C. The Feature Lifecycle
D. Gradle Command Line
E. Documentation licenses
Glossary
List of Examples
4.1. Executing multiple tasks
4.2. Excluding tasks
4.3. Abbreviated task name
4.4. Abbreviated camel case task name
4.5. Selecting the project using a build file
4.6. Selecting the project using project directory
4.7. Forcing tasks to run
4.8. Obtaining information about projects
4.9. Providing a description for a project
4.10. Obtaining information about tasks
4.11. Changing the content of the task report
4.12. Obtaining more information about tasks
4.13. Obtaining detailed help for tasks
4.14. Obtaining information about dependencies
4.15. Filtering dependency report by configuration
4.16. Getting the insight into a particular dependency
4.17. Information about properties
6.1. Running the Wrapper task
6.2. Wrapper task
6.3. Wrapper generated files
6.4. Specifying the HTTP Basic Authentication credentials using system properties
6.5. Specifying the HTTP Basic Authentication credentials in distributionUrl
6.6. Generating a SHA-256 hash
6.7. Configuring SHA-256 checksum verification
8.1. Declaring dependencies
8.2. Definition of an external dependency
8.3. Shortcut definition of an external dependency
8.4. Usage of Maven central repository
8.5. Usage of JCenter repository
8.6. Usage of a remote Maven repository
8.7. Usage of a remote Ivy directory
8.8. Usage of a local Ivy directory
8.9. Publishing to an Ivy repository
8.10. Publishing to a Maven repository
9.1. Listing the projects in a build
11.1. Dependencies of my-app
11.2. Declaring a command-line composite
11.3. Declaring a separate composite
11.4. Depending on task from included build
11.5. Build that does not declare group attribute
11.6. Declaring the substitutions for an included build
11.7. Depending on a single task from an included build
11.8. Depending on a tasks with path in all included builds
12.1. Setting properties with a gradle.properties file
12.2. Configuring an HTTP proxy
12.3. Configuring an HTTPS proxy
14.1. Using the tooling API
15.1. Pull from HttpBuildCache
15.2. Recommended setup for CI push use case
15.3. Consistent setup for buildSrc and main build
15.4. Configure built-in build caches
16.1. Your first build script
16.2. Execution of a build script
16.3. A task definition shortcut
16.4. Using Groovy in Gradle's tasks
16.5. Using Groovy in Gradle's tasks
16.6. Declaration of task that depends on other task
16.7. Lazy dependsOn - the other task does not exist (yet)
16.8. Dynamic creation of a task