Synchronize Gradle projects with workspace failed

An hour of wasted effort to troubleshoot an error while trying to import a simple Java application using Gradle! Eventually I was able to fix the issue. But the work is not done yet, until I write a quick blog post and document the error and the resolution.

I have been setting up my development environment to get started creating a Spring Boot Microservice using Spring Initializr.

Spring Initializr provides an extensible API to generate quick-start projects with the dependencies you need. Check it out here —

SpringBoot is popularly used to develop Spring applications and it eliminates need of lot of the boilerplate configuration. It comes with an embedded Tomcat server and you can just browse to localhost:8080 once you run your application to view the result.

I bumped into the below error while trying to import an existing Gradle project —

Synchronize Gradle Projects Error

Error Description

Synchronize Gradle projects with workspace failed due to an error connecting to the Gradle build. Could not create an instance of Tooling API implementation using the specified Gradle distribution ‘’.

Could not determine java version from ‘9.0.1’.

Caused by: org.gradle.internal.service.ServiceCreationException: Could not create service of type FileWatcherFactory using GlobalScopeServices.createFileWatcherFactory().

Caused by: java.lang.IllegalArgumentException: Could not determine java version from ‘9.0.1’. Seems like this is an issue with the Gradle version being incompatible with Java version 9.Upgrading the gradle version can actually fix this issue.

After reading the error details, it looked to me as if the Gradle version was not compatible with the Java Version.

I modified the distributionUrl  field in the file to point to the latest gradle version 4.4.1. This properties file is present in the project/gradle/wrapper folder. 



Incase you are using the Gradle Project Import Wizard, you can also specify the version of Gradle you want to use —

Specify Gradle Version

Once I did that I was able to successfully synchronize the Gradle Build with my workspace and run my Java application.



Running Program

Hopefully this blogpost is helpful and if you bump into a similar error while importing or running your Java application make sure you have compatible versions of Gradle and JDK installed.

Categories: Java

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: