Languages

IntelliJ - Groovy compilation error

7 points
Asked by:
Root-ssh
66584

When I try build my Groovy project in IntelliJ IDEA Community Edition I get following error:

Groovyc: Internal groovyc error: code 1

Detailed error:

Executing pre-compile tasks...
Loading Ant Configuration...
Running Ant Tasks...
Internal caches are corrupted or have outdated format, forcing project rebuild: backward reference index will be updated to actual version
Cleaning output directories...
Running 'before' tasks
Checking sources
Copying resources... [e2e-ui]
Groovyc: loading sources... [tests of e2e-ui]
Groovy compiler in operation... [tests of e2e-ui]
Groovyc: While compiling tests of e2e-ui:java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.classgen.Verifier
	at org.codehaus.groovy.control.CompilationUnit.<init>(CompilationUnit.java:169)
	at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner$2.<init>(DependentGroovycRunner.java:368)
	at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.createCompilationUnit(DependentGroovycRunner.java:368)
	at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:102)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:81)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:564)
	at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:167)
	at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:77)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:832)

Groovyc: Internal groovyc error: code 1
Finished, saving caches...
Executing post-compile tasks...
Loading Ant Configuration...
Running Ant Tasks...
Synchronizing output directories...
09.10.2020, 14:47 - Build completed with 1 error and 0 warnings in 1 s 888 ms

Screenshot:

How to solve it ?

1 answer
0 points
Answered by:
Root-ssh
66584

I had same probrem on my Ubuntu 20.04.

It was caused by incorrect Java version. So, try to chamge to Java 13.

In my case I have set JAVA_HOME env variable to local instalation directory:

/home/greg/.jdks/azul-13.0.4

Note: JDK azul-13.0.4 was installed automatically by IntelliJ IDEA, so check your installation path.

You can set JAVA_HOME in ~/.profile file. Just put at file begining:

export JAVA_HOME="/home/greg/.jdks/azul-13.0.4"
export PATH=$PATH:$JAVA_HOME/bin:$HOME/bin

Note: do not forget to logout and login or restart your operating system.

0 comments Add comment
Native Advertising
50 000 ad impressions - 449$
🚀
Get your tech brand or product in front of software developers.
For more information contact us:
Red dot
Dirask - friendly IT community for everyone.

❤️💻 🙂

Join