# Best Practices Index

version 9.8.0-milestone-2

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:

Filter by Section:
Filter by Version:

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
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 | Structuring Builds | 9.3.0
Single GAV String | Dependencies | 8.14
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
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 | Task | 8.14
Favor @CacheableTask and @DisableCachingByDefault over cacheIf(Spec) and doNotCacheIf(String, Spec) | Task | 8.14
Group and Describe custom Tasks | Task | 9.0.0
Do not call `get()` on a Provider outside a Task action | Task | 9.1.0
Don’t resolve Configurations before Task Execution | Task | 9.1.0
Avoid using eager APIs on File Collections | Task | 9.1.0
Prefer `@PathSensitivity.NONE` for file inputs and `@PathSensitivity.RELATIVE` for directories | Task | 9.2.0
Use unique output files and directories | Task | 9.3.0
Don’t hardcode task names when referring to them | Task | 9.7.0
Don’t access a `Project` instance during Task Execution | Task | 9.7.0
Wiring Task Outputs with `map` and `flatMap` | Task | 9.7.0
Favor collection property types over a `Property` holding a collection | Task | 9.8.0
Enable UTF‑8 | 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
Prefer the `-bin` Gradle Distribution | Performance | 9.4.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.7.0
Test your custom Task and Plugins with TestKit | Testing | 9.4.0