I'm compiling a project that works OK in Eclipse, and builds fine with ant, but in IntelliJ IDEA gives:
Internal groovyc error: code 1
How can I resolve this? Other error messages include:
1:35:46 PM Unknown Natures Detected
Imported projects contain unknown natures:
org.eclipse.jdt.groovy.core.groovyNature
Some settings may be lost after import.
1:43:55 PM Compilation completed with 1 error and 7 warnings in 20 sec
Groovyc: Cannot compile Groovy files: no Groovy library is defined for module
Groovy itself is installed on Linux. Adding it as a groovy compiler in settings does not affect the behavior:
> groovy --version
Groovy Version: 1.7.4 JVM: 1.6.0_24
Apparently you tried to import an Eclipse project into IDEA, and that isn't good enough. (Groovy) Eclipse comes with its own version of Groovy, whereas in IDEA, you have to add groovy-all-1.7.4.jar (or whatever version you want to use) as a compile dependency.
You have to add JAXB dependencies if you are using Groovy 2.5.3 + Java 11 (also check out Java 11 related change). Groovy comes with extra JAXB Jars so we can add them. Open 'Project Structure' dialog, then select 'Dependencies' tab and add the dependencies
Changing the project SDK from Java 15
to Java 8
seemed to have magically fixed the same problem on my machine.
Steps:
Go to File > Project structure...
(may differ on Mac/Linux).
Under Project Settings, select Project
.
In Project SDK:
dropdown, choose a different version of the JDK installed.
Click Apply
& OK
at the bottom of the dialog.
**
Rerun your program.
This worked for me!!
Read the log before the "Internal groovyc error: code 1", then it should show you a groovy version mismatch. Change your groovy version from the dependency list as per the log.
Ex. compile 'org.codehaus.groovy:groovy-all:2.4.11'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With