Gradle
lastmod 2024-11-06created 2014-03-0121 edits
Categories
- Gradle:Wrapper
- Android:Gradle - About Android Gradle builds
Example
Monorepo Projects
- Monorepo
- Bazel (by Google) - A fast, scalable, multi-language and extensible build system.
- Gradle (by Gradle, Inc) - A fast, flexible polyglot build system designed for multi-project builds.
- Lage (by Microsoft) - Task runner in JS monorepos
- Lerna - A tool for managing JavaScript projects with multiple packages.
- Nx (by Nrwl) - Next generation build system with first class monorepo support and powerful integrations.
- Rush (by microsoft) - Geared for large monorepos with lots of teams and projects. Part of the Rush Stack family of projects.
- Turborepo (by Vercel) - The high-performance build system for JavaScript & TypeScript codebases.
- Pants
- Earthly
Gradle Wrapper
The Gradle Wrapper provides a way to distribute Gradle bundled with the project, instead of installing it on each developer's machine or CI server.
Why use the Wrapper
The recommended way to run a Gradle build is with the Gradle Wrapper. The Wrapper is a script that invokes a declared version of Gradle, downloading it beforehand if necessary. As a result, you can get started with a Gradle project quickly without going through a manual installation process.
In other words, with the Gradle Wrapper you can build an existing project right away in a new environment. You don't even need to install java or gardle. That is, it does not depend on the environment.
See Gradle Wrapper for details.
Compatibility Matrix
Java
A Java version between 8 and 19 is required to run Gradle. Java 20 and later versions are not yet supported.
Java 6 and 7 can still be used for compilation and forked test execution.
Any supported Java version can be used for compilation or testing.
For older Gradle versions, see the table below for the Java versions supported by each Gradle release.
| Java version | First Gradle version to support it |
| 8 | 2.0 |
| 9 | 4.3 |
| 10 | 4.7 |
| 11 | 5.0 |
| 12 | 5.4 |
| 13 | 6.0 |
| 14 | 6.3 |
| 15 | 6.7 |
| 16 | 7.0 |
| 17 | 7.3 |
| 18 | 7.5 |
| 19 | 7.6 |
Kotlin
Gradle has been tested with Kotlin 1.6.10 through 1.8.10. Beta and RC versions may or may not work.
| Gradle version | Embedded Kotlin version | Kotlin Language version |
| 5.0 | 1.3.10 | 1.3 |
| 5.1 | 1.3.11 | 1.3 |
| 5.2 | 1.3.20 | 1.3 |
| 5.3 | 1.3.21 | 1.3 |
| 5.5 | 1.3.31 | 1.3 |
| 5.6 | 1.3.41 | 1.3 |
| 6.0 | 1.3.50 | 1.3 |
| 6.1 | 1.3.61 | 1.3 |
| 6.3 | 1.3.70 | 1.3 |
| 6.4 | 1.3.71 | 1.3 |
| 6.5 | 1.3.72 | 1.3 |
| 6.8 | 1.4.20 | 1.3 |
| 7.0 | 1.4.31 | 1.4 |
| 7.2 | 1.5.21 | 1.4 |
| 7.3 | 1.5.31 | 1.4 |
| 7.5 | 1.6.21 | 1.4 |
| 7.6 | 1.7.10 | 1.4 |
| 8.0 | 1.8.10 | 1.8 |
Groovy
Gradle has been tested with Groovy 1.5.8 through 4.0.0.
Gradle plugins written in Groovy must use Groovy 3.x for compatibility with Gradle and Groovy DSL build scripts.
Android
Gradle has been tested with Android Gradle Plugin 7.3, 7.4, and 8.0. Alpha and beta versions may or may not work.
For more about Android, see the Compatibility Matrix page.
Adding a specific local JAR file as a dependency
- IntelliJ IDEA#Adding a specific local JAR file as a dependency
- Maven -> pom.xml#Adding a specific local JAR file as a dependency
- Apache Ant -> build.xml#Adding a specific local JAR file as a dependency
See build.gradle#Adding a specific local JAR file as a dependency.
Apache Ant vs Apache Maven vs Gradle
See Apache Maven#Apache Ant vs Apache Maven vs Gradle.
Troubleshooting
Unsupported class file major version 61
- (Trial-and-error log) Unsupported class file major version 61 error
- Java - Unsupported class file major version 61 - Mkyong.com
- (Android) Unsupported class file major version error
This error occurs when the gradle and jdk versions do not match.
For reference, "class file major version 61" is JDK 17. See Java class file#General layout for details.
For reference, I downgraded from jdk 17 to 11.
See #Compatibility Matrix for the version table.
Builds only work in Android Studio
Android Studio has a built-in JDK, so check that path.
Android-studio_-settings-_gradle-jdk.png
See also
Favorite site
C++ Build
Beginners guide
- Building a Java project with Gradle
- Summary: Starting a Java project with Gradle
- (Gradle) build.gradle basics
- Gradle Dependencies