In a previous post, we talked about how to build Spring Boot Maven projects using Java 9 and Docker. Now we are going to do the same thing for Gradle projects. We’ll use the offical Gradle Docker image with tag
4.0.1-jdk9. The sample project is also created using Spring Initializr.
It’s good to know that the Java 9 version in this Docker image has upgraded to buid
Before we run the Gradle build, we need to update the
9. Java 9 has updated the version strings schema. The prefix
1 has been removed. The version strings of Java 9 start from
sourceCompatibility = 9
We use following command to run
$ docker run --rm -v "$PWD":/project -w /project \
To fix potential issues with Gradle, it’s better to set the flag
--illegal-access=permit. We can add following configuration to the file
Check out my book Exploring Java 9 for new features in Java 9.