PacktLib: Gradle Effective Implementation Guide

Gradle Effective Implementation Guide

Credits

About the Author

Acknowledgement

About the Reviewers

www.PacktPub.com

Preface

Starting with Gradle

Introducing Gradle

Getting started

Writing our first build script

Default Gradle tasks

Task name abbreviation

Executing multiple tasks

Command-line options

Understanding the Gradle user interface

Summary

Creating Gradle Build Scripts

Writing a build script

Defining tasks

Build scripts are Groovy code

Defining dependencies between tasks

Setting default tasks

Organizing tasks

Adding tasks in other ways

Accessing tasks as project properties

Adding additional properties to tasks

Avoiding common pitfalls

Skipping tasks

Summary

Working with Gradle Build Scripts

Working with files

Project properties

Using logging

Using the Gradle wrapper

Summary

Using Gradle for Java Projects

Using plugins

Getting started

Using the Java plugin

Working with source sets

Working with properties

Creating documentation

Assembling archives

Summary

Dependency Management

Dependency configuration

Repositories

Defining dependencies

Summary

Testing, Building, and Publishing Artifacts

Testing

Running Java applications

Publishing artifacts

Packaging Java Enterprise Edition applications

Summary

Multi-project Builds

Working with multi-project builds

Working with Java multi-project builds

Using the Jetty plugin

Summary

Mixed Languages

Using the Groovy plugin

Using the Scala plugin

Summary

Maintaining Code Quality

Using the Checkstyle plugin

Using the PMD plugin

Using the FindBugs plugin

Using the JDepend plugin

Using the CodeNarc plugin

Using the Sonar plugin

Summary

Writing Custom Tasks and Plugins

Creating a custom task

Creating a task in the project source directory

Creating a task in a standalone project

Creating a custom plugin

Creating a plugin in the project source directory

Creating a plugin in a standalone project

Summary

Using Gradle with Continuous Integration

Creating a sample project

Using Jenkins

Using JetBrains TeamCity

Using Atlassian Bamboo

Summary

IDE Support

Using the Eclipse plugin

Using the IntelliJ IDEA plugin

Running Gradle in Eclipse

Running Gradle in IntelliJ IDEA

Summary

Index