Project not compiling when using Groovy 1.6.0 (no warnings or errors)
Hi everyone,
I apologise for the noobish question, but here is my problem:
I have a project write partly in Groovy and partly in Java, which I've been coding, compiling and deploying with IDEA for several months.
It work fine with IDEA 7 and 7.x (all EAPs) and it works fine with 8.0, 8.1 and 8.x EAPs.
I'm using Java JDK 1.6u11 and Groovy 1.5.6 on Windows XP SP2.
The problem is, when I recently change my Groovy libs from 1.5.6 to 1.6.0, the project does not compile as expected.
The make process finishes without apparent problems, but the Jar size is very different (the new Jar is quite small) and the application does not run.
The libraries and facets are properly configured (I've double checked them at least a dozen times), as are the modules.
In fact the only change in the project is pointing to Groovy 1.6.0 instead of 1.5.6.
When revert the change to 1.5.6, it compiles fine again and the app runs...
Any ideas of what the problem might be?
Many thanks in advance.
请先登录再写评论。
Which build are you using? Please upgrade to the latest EAP.
Then, if the problem repeats, add the following lines to your
bin/log.xml in IDEA distribution, rebuild the project (or better
unsuccessfully recompile one file) and attach the system/logs/idea.log here.
]]>
Hi Peter,
Thanks for the reply.
I went back to EAP9732 (the more recent builds were even more problematic: the constant "loading" on the project view, not compiling at all, etc).
EAP9732 at least compiles fine for 1.5.6, just not 1.6.0
I went through the idea.log file and didn't find any possible reference to this problem.
Just a few INFO lines and a single error (related to jetbrains.communicator.jabber.impl.JabberFacadeImpl._createConnection , not related).
I have really no idea what could be happening.
Did you add the mentioned XML lines to log.xml first?
Hi Peter,
Thanks for the quick reply, but I couldn't look at the problem for some time.
I don't want to seem thick, but which lines should I had to the xml file?
Thanks again
Most probably your problem got fixed recently and the fix will be
available in the next 8.1.1 EAP.
Hi Peter,
I've downloaded today 8.1.1, and indeed many of the problems of the previous EAP release seem fixed.
But I've encountered this problem:
The compiling process terminates because it runs out of memory (OutOfMemory heap error).
I've increase the available memory both on the compiler section and on the IDEA VM options to 1024m, but the error still occurs.
It seems a bit excessive already 1024m, is there anything else I can do?
Many thanks!
You can trigger the groovy compiler Xmx in idea.properties:
groovy.compiler.Xmx=500m (or bigger).
Is the project you are compiling big?
Hi again Peter and thanks for the help,
I increase the memory in the properties files (up to 1024m), and I'm still getting an error.
Information:Note: Some input files use unchecked or unsafe operations.
Information:Note: Recompile with -Xlint:unchecked for details.
Information:Compilation completed with 1 error and 1 warning
Information:1 error
Information:1 warning
Error:java.lang.OutOfMemoryError: Java heap spaceat java.util.EnumMap.<init>(EnumMap.java:113)at org.codehaus.groovy.ast.ClassNode.<init>(ClassNode.java:309)at org.codehaus.groovy.ast.ClassNode.<init>(ClassNode.java:238)at org.codehaus.groovy.ast.ClassHelper.makeWithoutCaching(ClassHelper.java:156)at org.codehaus.groovy.ast.ClassHelper.make(ClassHelper.java:148)at org.codehaus.groovy.ast.ClassHelper.make(ClassHelper.java:137)at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:316)at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:269)at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:253)at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:340)at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:844)at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:829)at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:819)at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:2639)at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:2617)at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55)at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4021)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCallSite(AsmClassGenerator.java:1955)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCall(AsmClassGenerator.java:1789)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCall(AsmClassGenerator.java:1775)at org.codehaus.groovy.classgen.AsmClassGenerator.makeInvokeMethodCall(AsmClassGenerator.java:1758)at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:2267)at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:63)at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4021)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCallSite(AsmClassGenerator.java:1931)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCall(AsmClassGenerator.java:1789)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCall(AsmClassGenerator.java:1775)at org.codehaus.groovy.classgen.AsmClassGenerator.makeInvokeMethodCall(AsmClassGenerator.java:1758)at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:2267)at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:63)at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4021)at org.codehaus.groovy.classgen.AsmClassGenerator.makeCallSite(AsmClassGenerator.java:1955)
The project consist of +1500 classes.
Thanks.
IDEA's heap size doesn't matter, groovyc is run in a separate process.
It's heap size is controlled by 'groovy.compiler.Xmx' property which can
be set in idea.properties file (unfortunately no UI for it yet).
I seem to have the same problem as outlined in the original post. Make for a combined Java & Groovy project fails with the OutOfMemoryError shown below, while the command line Maven build works flawless. I tried setting groovy.compiler.Xmx=512m in the idea.properties file, but this did not help.
Originally the same configuration did work with Groovy 1.5.7 & 1.6.1, but after changing the Groovy version to 1.6.2 in my main pom.xml the OutOfMemoryError keeps occuring. Even after reverting back to 1.6.1 and cleaning all local caches.
My environment:
* OS X Leopard
* Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
* IntelliJ EAP build 9821
* IntelliJ memory settings: -Xms256m -Xmx1024m -XX:MaxPermSize=512m
Ruben Verlinden
Error:java.lang.OutOfMemoryError: Java heap spaceat java.util.HashMap.<init>(HashMap.java:209)at org.codehaus.groovy.ast.ClassNode.<init>(ClassNode.java:316)at org.codehaus.groovy.ast.ClassNode.<init>(ClassNode.java:239)at org.codehaus.groovy.ast.ClassHelper.makeWithoutCaching(ClassHelper.java:156)at org.codehaus.groovy.ast.ClassHelper.make(ClassHelper.java:148)at org.codehaus.groovy.ast.ClassHelper.make(ClassHelper.java:137)at org.codehaus.groovy.vmplugin.v5.Java5.makeClassNode(Java5.java:316)at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:269)at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:258)at org.codehaus.groovy.ast.ClassNode.getInterfaces(ClassNode.java:342)at org.codehaus.groovy.ast.ClassNode.declaresInterface(ClassNode.java:843)at org.codehaus.groovy.ast.ClassNode.implementsInterface(ClassNode.java:828)at org.codehaus.groovy.ast.ClassNode.isDerivedFromGroovyObject(ClassNode.java:818)at org.codehaus.groovy.classgen.AsmClassGenerator.isGroovyObject(AsmClassGenerator.java:2639)at org.codehaus.groovy.classgen.AsmClassGenerator.visitPropertyExpression(AsmClassGenerator.java:2613)at org.codehaus.groovy.ast.expr.PropertyExpression.visit(PropertyExpression.java:55)at org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmClassGenerator.java:3957)at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1324)at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:49)at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:4029)at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:1305)at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:40)at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:38)at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:129)at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:665)at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)at org.codehaus.groovy.classgen.AsmClassGenerator.visitIfElse(AsmClassGenerator.java:848)at org.codehaus.groovy.ast.stmt.IfStatement.visit(IfStatement.java:41)at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:38)at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:129)at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:665)at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:52)
Please tweak the groovy.compiler.Xmx property as described above
I ended going back to Groovy 1.5.6 as the new features don't justify having the project stalled until I find a solution.
This is really annoying, I can say I tried everything I could think of...
Just for the sake of it, I tried it with the latest EAP (9821), and the problem still occurs.... :-/
I already tried setting groovy.compiler.Xmx=512m in idea.properties.
The weird thing is that it used to work with Groovy 1.6.1, afterwards the problem occurred with Groovy 1.6.2. And after reverting to Groovy 1.6.1 it does not work again, the OutOfMemoryError still occurs.
kind regards,
Ruben Verlinden
Then you may try to set 'profile.groovy.compiler=true' in
idea.properties, send us the CPU snapshot and we'll check what's
happening. You should also have memory snapshots created automatically
on out of memory error, please upload one to ftp.intellij.net/.uploads
In a different Maven module within the same project I can run Groovy tests from within IntelliJ. This module only has a few Groovy classes, while the module where the Make fail has more (146 Groovy class files + some files with multiple classes defined) Groovy classes.
Ruben
I enabled profiling for the groovy compiler, and uploaded the entire content of the log directory for one run to Thread-5236743-log.zip in the ftp directory.
Thanks for the quick response,
Ruben Verlinden
Sorry, logs directory doesn't contain snapshots. You should search for
them in /Snapshots (for CPU, .snapshot one) and in ]]>/bin (for
.hprof one).
Sorry, I've forgotten that you should also enable YourKit profiling
before profiling, as described in
http://www.jetbrains.net/devnet/docs/DOC-192.
The snapshot and dump are uploaded to the ftp directory as Thread-5236759_dump-and-log.zip
Ruben
The CPU snapshot shouldn't be taken from IDEA's buttons, that's another
process (groovyc) we are profiling. After you enable the
'profile.groovy.compiler', another CPU snapshot (named either
GroovycRunner* or CommandLineWrapper*) should appear in your Snapshots
directory. It should contain some valuable data which can help us in
fixing the problem.
BTW what's the groovyc heap size setting in command line script?
The GroovyCompiler snapshot is uploaded in file Thread-5236822_GroovyCompiler-snapshot.zip .
I don't know which memory settings GMaven uses. I have no explicit memory settings configured for the GMaven plugin, the Maven memory settings are -Xmx512m -Xms256m -XX:PermSize=128m
Ruben
From the snapshots it appears that it's really groovyc that requires so
much memory. You may try to set its Xmx to more than 512m.
I need a project to reproduce this problem. Is your project open-source
so that I can play with it?
Sorry, the project is not open source so I can not simply pass on the source code.
I had the same problem with groovy.compiler.Xmx=1024m , so there probably is a memory leak in the groovyc compiler. But it certainly did work with Groovy 1.6.1 using GMaven.
Ruben
Thanks to the snapshot, it appears that there is a huge memory waste
inside groovyc. That doesn't free us of the question why does the
command line build pass at all. I have one idea, that GMaven was
recompiling your files incrementally all the time, while IDEA after some
failing tries to perform complete rebuild thus failing. Could you check
this hypothesis? If it's true, then command line build should fail if you
a) find out where does GMaven keep the compiled .class files and delete
them, OR
b) touch all your source files changing their timestamp OR
c) (probably the safest) copy your sources to another location, name
your project in another way and try to build from there.
Peter,
With GMaven it indeed also fails from a clean build. Using the latest Groovy 1.6.3 the project compiles again without a problem from within IntelliJ.
thx for the quick responses,
Ruben
Certainly, I've reported the memory leak to Groovy team and they've fixed it
Compilation now works with IntelliJ IDEA 9M1 and Groovy 1.7 beta 1
Compilation now works with IDEA 9M1 and Groovy 1.7 beta 1
Sure. The groovyc leak is fixed there. BTW there's a Groovy Compiler
Heap Size UI option in the upcoming Maia EAP.