Q: Why do I get an java.lang.OutOfMemoryError when compiling with Clover turned on?
A: Instrumenting with Clover increases the amount of memory that the compiler requires in order to compile.To solve this problem, you need to give the compiler more memory. Increasing the memory available to the compiler depends on how you are launching the compiler:
<javac>
task with the "fork"
attribute set to false
), you will need to give Ant itself more memory to play with. To do this, use the ANT_OPTS environment variable to set the heap size of the JVM used to run Ant:export ANT_OPTS=-Xmx256m
memoryInitialSize
and memoryMaximumSize
attributes of the javac
task:<javac srcdir="${src}" destdir="${build}" fork="true" memoryInitialSize="128m" memoryMaximumSize="256m"/>
Screenshot: Adjusting Heap Size in IntelliJ IDEA