The table below provides a complete list of documented Gradle Best Practices.

There are currently X Best Practices.

Use this as a quick reference to track newly added recommendations, check adoption status, or explore areas for improving your build:

Title Section Added in Gradle Version

Use Kotlin DSL

General

8.14

Use the Latest Minor Version of Gradle

General

8.14

Apply Plugins Using the plugins Block

General

8.14

Don’t Assume your Plugin is Applied after Another

General

9.4.0

Do Not Use Internal APIs

General

8.14

Set Build Flags in gradle.properties

General

9.0.0

Name Your Root Project

General

9.2.0

Do not use gradle.properties in subprojects

General

9.2.0

Avoid afterEvaluate

General

9.6.0

Consider use of @Incubating APIs carefully

General

9.7.0

Obtain Loggers via Logging.getLogger(Class) outside of Tasks

General

9.8.0

Modularize Your Builds

Structuring Builds

9.0.0

Do Not Put Source Files in the Root Project

Structuring Builds

9.0.0

Favor build-logic Composite Builds for Build Logic

Structuring Builds

9.0.0

Avoid Unintentionally Creating Empty Projects

Structuring Builds

9.1.0

Use Convention Plugins for Common Build Logic

Structuring Builds

9.3.0

Use Version Catalogs to Centralize Dependency Versions

Dependencies

9.0.0

Name Version Catalog Entries Appropriately

Dependencies

9.0.0

Set up your Dependency Repositories in the Settings file

Dependencies

9.0.0

Don’t Explicitly Depend on the Kotlin Standard Library

Dependencies

9.0.0

Avoid Redundant Dependency Declarations

Dependencies

9.0.0

Declare Dependencies using a single GAV (group:artifact:version) String

Dependencies

8.14

Use Content Filtering with multiple Repositories

Dependencies

9.1.0

Apply Exclusions Narrowly

Dependencies

9.2.0

Always Declare Attributes on Consumable and Resolvable Configurations

Dependencies

9.7.0

Avoid DependsOn

Tasks

8.14

Favor @CacheableTask and @DisableCachingByDefault over cacheIf(Spec) and doNotCacheIf(String, Spec)

Tasks

8.14

Do not call get() on a Provider outside a Task action

Tasks

9.1.0

Group and Describe custom Tasks

Tasks

9.0.0

Avoid using eager APIs on File Collections

Tasks

9.1.0

Don’t resolve Configurations before Task Execution

Tasks

9.1.0

Use @PathSensitivity.NONE for file inputs and @PathSensitivity.RELATIVE for directories

Tasks

9.2.0

Use unique output files and directories

Tasks

9.3.0

Don’t hardcode Task names unless they are documented as Public API

Tasks

9.7.0

Don’t access a Project instance during Task Execution

Tasks

9.7.0

Wire lazy task outputs using map and flatMap

Tasks

9.7.0

Favor collection property types over a Property holding a collection

Tasks

9.8.0

Prefer the -bin Gradle Distribution

Performance

9.4.0

Use UTF-8 File Encoding

Performance

9.0.0

Use the Build Cache

Performance

9.1.0

Use the Configuration Cache

Performance

9.1.0

Avoid Expensive Computations in Configuration Phase

Performance

9.0.0

Validate the Gradle Distribution SHA-256 Checksum

Security

9.1.0

Validate the Gradle Wrapper on every Upgrade

Security

9.3.0

Do not Run ./gradlew on Untrusted Projects

Security

9.7.0

Build Output Should Be Byte-for-Byte Reproducible

Security

9.7.0

Build your Published Artifacts Securely

Security

9.8.0

Test your custom Task and Plugins with TestKit

Testing

9.4.0