(Note: The cheat-sheet generally shows Linux/macOS specific commands. For Windows, replace e.g. ./gradlew build
with just gradlew build
, as the "." will lead to errors)
In addition to fumbling around with your JAVA_HOME
env variable, do this:
-
gradle.properties
in your project directory// Note: Even on Windows, forward slashes only!!! org.gradle.java.home=/path_to_jdk_directory
-
gradle.properties
in the .gradle directory in your HOME_DIRECTORY// Note: Even on Windows, forward slashes only!!! org.gradle.java.home=/path_to_jdk_directory
Instead of doing this:
cd myproject
cd mysubmodule
../gradlew.bat build
do:
cd myproject
./gradlew build -p mysubmodule
// or
./gradlew :mysubmodule:build
// ./gradlew wrapper --gradle-version {version}
./gradlew wrapper --gradle-version 8.4
If that fails, e.g. the new Gradle version is incompatible with your project or your JDK version you will be stuck in an endless loop, because you won’t be able to run the wrapper anymore.
You can then do a "hard-reset" by changing the Gradle wrapper version in this file:
yourprojectgradle\wrapper\gradle-wrapper.properties
## change the version number in the distributionUrl
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip
-
compile
<→api
(public, i.e. will become a transitive dependency for other modules) andimplementation
(private, other modules won’t "see" the dependency) -
testCompile
<→testImplementation
Always refresh.
Never forget to click that button, after changing your build.gradle(.kts)
file.
mbimage::/images/guides/gradle_refresh_button.png[]
See section Version Properties
here: https://docs.spring.io/spring-boot/docs/current/reference/html/dependency-versions.html or all possible versions to override.
// in your build.gradle file
ext['jetty.version'] = '11.0.14'