Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error:BUG! exception in phase 'class generation' in source unit '_BuildScript_' unsupported Target MODULE

I'm trying to create a new Java 9 project using gradle but right after project creation I received error from gradle:

Error:BUG! exception in phase 'class generation' in source unit '_BuildScript_' unsupported Target MODULE

Java version: 9 (build 9+178)
Gradle version: 4.1-rc-2

According to this article those java/gradle versions should be compatible.
How can I solve this problem?

Any help highly appreciated.

like image 977
Michał Szewczyk Avatar asked Aug 26 '17 19:08

Michał Szewczyk


4 Answers

I have solved it by downgrading Gradle JVM to 8. It is not perfect but keeps you going while jdk9 and gradle and intellij stabilises.

Intellij View

like image 106
kamaz Avatar answered Nov 06 '22 15:11

kamaz


Setting the Gradle home to local Gradle distribution solved the issue in my case.

  • Java version: 9+181
  • Gradle version: 4.1
  • Intellij version: 2017.2.2

if we set to use default Gradle wrapper, IntelliJ downloads an earlier version of Gradle. I think it is the reason for failure.

enter image description here

like image 21
Narendran Solai Sridharan Avatar answered Nov 06 '22 16:11

Narendran Solai Sridharan


Seems fixed in 2017.3

See IntelliJ IDEA 2017.3 173.2941.3 Release Notes: https://confluence.jetbrains.com/display/IDEADEV/IntelliJ+IDEA+2017.3+173.2941.3+Release+Notes

See issue: https://youtrack.jetbrains.com/issue/IDEA-171520

like image 3
Sormuras Avatar answered Nov 06 '22 17:11

Sormuras


This issue seems to have been fixed in Groovy 2.4.12 and upgrading to at least that version resolved a similar problem in https://github.com/jenkinsci/JenkinsPipelineUnit/issues/292.

like image 1
dB. Avatar answered Nov 06 '22 15:11

dB.