Gradle Goodness Notebook
Gradle Goodness Notebook
Experience Gradle through code snippets
About the Book
In 2009 I started to write small blog posts about Gradle at Messages from mrhaki. The posts contained code samples of cool Gradle features I just didn't want to forget. The blog posts turned out to be a useful resource for people learning and using Groovy in their every day programming.
The Gradle Goodness Notebook contains the blog posts about Gradle previously mentioned on my blog. The posts have been edited slightly so they can be used for the book. The book gives a broad overview of all the great features we can find in the Gradle build tool.
Latest update on April 18, 2023 with the following blog posts:
- Defining Plugin Versions Using Version Catalog
- Grouping Version Catalog Dependencies Into Bundles
- Set Test Framework Version Using Version Catalog With JVM Test Suite Plugin
- Using Spock With JVM Test Suite Plugin
- Add Extra Dependencies For Running Tests Using JVM Test Suite Plugin
- Set Project Version In Version Catalog
- Configure Test Task With JVM Test Suite
- Publish Version Catalog For Sharing Between Projects
The book contains the following sections:
- Configuration
- Tasks
- Command line
- Java and Groovy
- Managing Dependencies
- Testing Support
- IDE
- Miscellaneous
Bundles that include this book
Table of Contents
- About Me
- Introduction
-
Configuration
- Changing the Project Name
- Changing Name of Default Build File
- Display Gradle Information in the Build
- Setting Global Properties For All Gradle Builds
- Using Properties for Multiple Environments or Profiles
- Define System Properties in gradle.properties File
- Changing the Gradle User Home Directory
- Set Project Version In Version Catalog
- Different Ways to Set Project Properties
- Setting Plugin Version From Property In Plugins Section
- Using System Properties Lazily
- Using Environment Variables Lazily
- Shared Configuration With Conventions Plugin
- Custom Plugin Repositories With Plugins DSL
- Get Property Value With findProperty
- Lazy Project Property Evaluation
- Change Local Build Cache Directory
- Enable Build Cache For All Builds
- Using Objects for Version
- Build Script Using Java Syntax
- Check Operating System In Build Scripts
- Creation Rules For Rule Based Model Configuration Using Model DSL
-
Tasks
- Get User Input Values From Console
- Organizing Tasks Using The Task Container
- Group Similar Tasks
- Adding Tasks to a Predefined Group
- Getting Information About Buildscript Dependencies
- Create Properties File With WriteProperties Task
- Add Incremental Build Support to Tasks
- Add Incremental Build Support to Custom Tasks with Annotations
- Using Incremental Task Action
- Command Line Options For Custom Tasks
- Enable Task Based On Offline Command Line Argument
- Set Task Values with Project Convention
- Methods Generated For Setting Task Properties
- Lazy Task Properties
- Adding Custom Extension To Tasks
- Use Command Line Options With Custom Tasks
- Automatic Clean Tasks
- Parse Files with SimpleTemplateEngine in Copy Task
- Copy Files with Filtering
- Renaming Files while Copying
- Using CopySpec with Tasks
- Handle Copying Duplicate Files
- Replace Files In Archives
- Working with Live Task Collection
- Unpacking an Archive
- Create Checksums for Archives
- Skip Task When Input Empty Using @SkipWhenEmpty Annotation
- Inter-Project Artifact Dependencies
- Adding Task With Rule Based Model Configuration
- Using Optional Ant Task in Gradle
-
Command line
- Execute Tasks with Abbreviations
- Pass Command-line Arguments to Build Script
- Run a Build Script With a Different Name
- Excluding Tasks for Execution
- Display Available Tasks
- Getting More Help For a Task
- Using Continuous Build Feature
- Only Show All Tasks In A Group
- Check Task Dependencies With a Dry Run
- Skip Building Project Dependencies
- Continue Build Even with Failed Tasks
- Run Task Ignoring Up-to-date Checks
- Rerun Incremental Tasks At Specific Intervals
- Profiling Information
- Stop Build After One Failing Test
- Use gradlew for Easy Gradle Execution
- Change Gradle Wrapper Script Name
- Specify Wrapper Version and Distribution Type From Command Line
- Check The Gradle Daemon Status
-
Java and Groovy
- Set Java Version Compatibility
- Set Java Compiler Encoding
- Enabling Preview Features For Java
- Using Maven Toolchains Configuration For Gradle Java Toolchain Resolution
- Java Toolchain Configuration Using User Defined Java Locations
- Using Gradle for a Mixed Java and Groovy Project
- A Groovy Multi-project with Gradle
- Run Java Application From Build Script
- Running Java Applications from External Dependency
- Pass Java System Properties To Java Tasks
- Add Support For "Scratch" Files To Java Project
- Running Groovy Scripts as Application
- Alter Start Scripts from Application Plugin
- Running Groovy Scripts Like From Groovy Command Line
- Generate Javadoc In HTML5
- Create JAR Artifact with Test Code for Java Project
- Add Filtering to ProcessResources Tasks
- Use Groovy Ruleset File with Code Quality Plugin
- Don't Let CodeNarc Violations Fail the Build
-
Managing Dependencies
- Shortcut Notation for Dependencies
- Display Dependencies for a Gradle Build
- Getting More Dependency Insight
- Exclude Transitive Dependency from All Configurations
- Adding Dependencies Only for Packaging to War
- Manage Dependency Versions With Dependency Constraints
- Use bill of materials (BOM) As Dependency Constraints
- Defining Plugin Versions Using Version Catalog
- Grouping Version Catalog Dependencies Into Bundles
- Publish Version Catalog For Sharing Between Projects
-
Testing Support
- Running a Single Test
- Running Tests in Parallel
- Running All Tests From One Package
- Configure Test Task With JVM Test Suite
- Set Test Framework Version Using Version Catalog With JVM Test Suite Plugin
- Using Spock With JVM Test Suite Plugin
- Add Extra Dependencies For Running Tests Using JVM Test Suite Plugin
- Show Standard Out or Error Output from Tests
- Show More Information About Failed Tests
- Specify Spock As Test Framework At Initialization
- Continuous Testing For Java Projects
-
IDE
- Delegate Build And Run Actions To Gradle In IntelliJ IDEA
- Passing Environment Variable Via Delegate Run Action In IntelliJ IDEA
- Customize IDEA Project File Generation
- Download Javadoc Files For Dependencies In IDE
- Create Shortcut Key To Refresh Gradle Projects In IntellIJ IDEA
- Quickly Open Test Report in IntelliJ IDEA
- Add Spring Facet To IntelliJ IDEA Module
- Configure IntelliJ IDEA To Use Gradle As Testrunner
- Enable Compiler Annotation Processing For IntelliJ IDEA
- Set VCS For IntelliJ IDEA In Build File
- Source Sets As IntelliJ IDEA Modules
-
Miscellaneous
- Parse Output from Exec Invocation
- Define A Short Plugin Id For Custom Plugins
- Base Plugin Usage
- Apply External Script With Plugin Configured Through Buildscript
- Init Script for Adding Extra Plugins to Existing Projects
- Alter Start Scripts from Application Plugin
- Add But Do Not Apply Plugin Using Plugins Block
- Set a Project Description
- Using and Working with Gradle Version
- Rename Ant Task Names When Importing Ant Build File
- Use Git Commit Id in Build Script
- Get Model Report In Short Format
- Getting Project Information Into Rule Based Model Configuration
- Set Default Values With Rule Based Model Configuration
- Show Hidden Model Objects
- Validate Model In Rule Based Model Configuration
- Getting Announcements from Gradle Build
- Extending DSL
- Create Objects Using DSL With Domain Object Containers
- Using Nested Domain Object Containers
- Distribute Custom Gradle in Our Company
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.
You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!
So, there's no reason not to click the Add to Cart button, is there?
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them