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 (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 build 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 built without any issues. If you have another solution to this, let me know in the comments!