Search code examples
javamavenmockitocoberturapowermockito

PermGen size error while generating Cobertura Report


I ram running into issue where my application throws PermGen size error whenever I generate cobertura report using this command clean cobertura:cobertura. I have the tried almost everything such as the following:

  • Increase permgen size in sts.ini
  • Increase permgen size in jdk vm argumemts by going into Windows -> Preferences -> Java -> Installed JREs -> click jdk -> edit and on the vm args

  • Increase permgen size in maven.bat file

  • Some in stackOverFlow recommended to mention the version in surefire plugin and I have that in place already

None of the above is helping me at all. I am using Mock/PowerMock objects a lot in my JUnit test cases. Maven test runs perfectly fine.

How can I fix this issue?

Thanks


Solution

  • Since you tried to change sts.ini, I'm assuming you are running it from inside STS. Even when Maven is kicked off by STS, it runs in a separate process from STS, so changing sts.ini wouldn't help. you need to set the MAVEN_OPTS with the increased permgen size in the run configuration for the mvn job.