junitreport ant task giving java.lang.OutOfMemoryError: Java heap space

前端 未结 4 687
一整个雨季
一整个雨季 2021-01-23 06:47

I\'m running junit tests from an ant script. The tests run successfully so ant moves on to the the junitreport task to create the html report. This task is failing with a

4条回答
  •  一整个雨季
    2021-01-23 07:11

    This error has been raised in ANT bug 34342. The general consensus is that it's caused by excessive memory consumption in the XSLT used to generate the report, and it WON'T be fixed in ANT.

    What has worked for me has been to increase the maximum heap size passed to ant, eg -Xmx3304m. As some of the other answers here mentioned, you can use ANT_OPTS to pass the maximum heap size to ant.

    Regarding the actual maximum heap size value, it is recommended that it should be either 1/4th of physical memory or 1GB, whichever is smaller. You may need to go beyond the 1GB limit to avoid this memory error however. See Garbage Collector Ergonomics guide on the Oracle website.

提交回复
热议问题