开发中的主程主推JUnit test, 要求任何一个service都要有Unit Test,并且还要求用H2 Embedded来跑所有的case。本人自己的case可以一个一个跑,但是直接用mvn test的时候就会报OOM error,最后google了一下,找到enlarge memory的方法。
解决方案:
http://stackoverflow.com/questions/4066424/java-lang-outofmemoryerror-java-heap-space-in-maven
因为我们是用maven-surefire-plugin 插件来做build的,所以这里就是在这个plugin里指定Xmx就好了。
Code
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <forkMode>pertest</forkMode> <argLine>-Xms512m -Xmx512m</argLine> <testFailureIgnore>false</testFailureIgnore> <skip>false</skip> </configuration> </plugin>
现在再run:mvn test -e 就没有不会溢出了。
--EOF--