I'm new to Maven.I'm using Mac OSX. I tried to build the project using maven and it happened properly. Then I used mvn spotbugs:spotbugs to use the spotbugs plugin! It took a while and threw Exception in thread "main"
java.lang.OutOfMemoryError: Java heap space.
The project I tried is 330 MB which is quite big and I can do nothing about it for now.I tried many solutions online:
1.export MAVEN_OPTS="-Xmx2048m"
(I tried increasing upto 12000m still wasn't working)
2.Used this plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<fork>true</fork>
<meminitial>1024m</meminitial>
<maxmem>8096m</maxmem>
</configuration>
</plugin>
and still didn't work.
Can anybody guide me through it? I'm using maven spotbugs version 3.1.12.
Using java 11,Maven 3
The SpotBugs Maven Plugin has "How do I avoid OutOfMemory errors?" in its FAQ which I assume you have seen (since you tried
MAVEN_OPTS="-Xmx2048m"
)But there is one more thing there
Looking at the docs is seams in
3.1.12.3-SNAPSHOT
thefork
option istrue
by default. If that is the case for3.1.12
(or whatever is the exact version you use) and if I'm reading the docs correctly, then you have to configure themaxHeap
which defaults to 512.