I recently saw this error when I was trying to set up a Java project in IntelliJ IDEA. The error appeared every time I tried to 'run' my gradle file. The project built fine outside of IntelliJ IDEA for example by running Gradle directly. The error was:
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine java version from '9.0.1'.
In order to solve this I pointed IntelliJ to my own gradle installation, instead of using the built in distribution. I did this by going to "File > Settings... > Build, Execution, Deployment > Gradle". Then I pointed IntelliJ to the location of Gradle on my PC. This of course requires you to have a Gradle installation on your machine.
After this my project was built without any issues, if you have another (better?) solution to this, let me know in the comments!