2014-05-14 87 views
0

使用Play 2.X,我希望我的測試默認分支(Play 2.X的新方式),尤其是運行良好。分叉測試失敗,因爲JavaOptions似乎配置錯​​誤

然而,在我Build.scala使用該SBT配置時,我觀察到一個OOM由於PermGen的空間,如下所示:

Uncaught exception when running myspecs.AllSpecs: java.lang.OutOfMemoryError: PermGen space 
sbt.ForkMain$ForkError: PermGen space 
    at java.lang.ClassLoader.defineClass1(Native Method) 
    at java.lang.ClassLoader.defineClass(ClassLoader.java:791) 
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) 
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) 
    at java.net.URLClassLoader.access$100(URLClassLoader.java:71) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356) 
    at scala.collection.parallel.immutable.LazyParVectorCombiner.result(ParVector.scala:129) 
    at scala.collection.parallel.immutable.LazyParVectorCombiner.result(ParVector.scala:105) 
    at scala.collection.Parallelizable$class.par(Parallelizable.scala:42) 
    at scala.collection.AbstractTraversable.par(Traversable.scala:105) 
    at org.specs2.reporter.AllExporting$$anonfun$export$1$$anonfun$2.apply(AllExporting.scala:28) 
    at org.specs2.reporter.AllExporting$$anonfun$export$1$$anonfun$2.apply(AllExporting.scala:27) 
    at scalaz.syntax.IdOps$class.$bar$greater(IdOps.scala:15) 
    at scalaz.syntax.ToIdOps$$anon$1.$bar$greater(IdOps.scala:82) 
    at org.specs2.reporter.AllExporting$$anonfun$export$1.apply(AllExporting.scala:32) 
    at org.specs2.reporter.AllExporting$$anonfun$export$1.apply(AllExporting.scala:24) 
    at scalaz.syntax.IdOps$class.$bar$greater(IdOps.scala:15) 
    at scalaz.syntax.ToIdOps$$anon$1.$bar$greater(IdOps.scala:82) 
    at org.specs2.reporter.AllExporting$class.report(AllExporting.scala:17) 
    at org.specs2.reporter.SbtConsoleReporter.report(SbtReporter.scala:20) 
    at org.specs2.runner.SbtRunner.org$specs2$runner$SbtRunner$$specificationRun(SbtRunner.scala:75) 
    at org.specs2.runner.SbtRunner$$anonfun$newTask$1$$anon$5.execute(SbtRunner.scala:59) 
    at sbt.ForkMain$Run.runTest(ForkMain.java:239) 
    at sbt.ForkMain$Run.runTestSafe(ForkMain.java:211) 
    at sbt.ForkMain$Run.runTests(ForkMain.java:187) 
    at sbt.ForkMain$Run.run(ForkMain.java:251) 

我的配置如下:
- 我ApplicationBuild.scala存在here
- 我plugins.sbt存在here
- 我的build.properties存在here

但如果我只是改變這一行:

javaOptions in (Test,run) ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled") 

通過這條線:

javaOptions ++= Seq("-Xms512M", "-Xmx2048M", "-XX:MaxPermSize=2048M", "-XX:+CMSClassUnloadingEnabled") 

整個工程。

爲什麼指定(Test, run)會使整體​​失敗?

我是否缺少Testrun以外的指定任務?

我真的想好看着辦吧:)

回答

1

在你cofiguration

javaOptions in (Test,run) ++= Seq(...) 

說,配置測試和運行的關鍵,但在運行測試未向密鑰運行完成,它與按鍵測試完成,所以您已經定義了別的東西的設置比運行測試的

javaOptions in (Test,test) ++= Seq(...) 

或只是

javaOptions in (Test) ++= Seq(...) 

應該讓你那裏!

+0

優秀:)非常感謝! – Mik378

相關問題