编译Play框架测试时出现错误“scala.reflect.internal.MissingRequirementError:找不到编译器镜像中的对象scala.runtime”

时间:2014-04-01 20:17:47

标签: java scala playframework sbt

我在系统上的每个播放项目执行“play clean test”时遇到此错误:

[info] Compiling 9 Scala sources and 302 Java sources to $HOME/Workspace/sis/target/scala-2.10/test-classes...
[error] error while loading , error in opening zip file
scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
    at scala.reflect.internal.MissingRequirementError$.signal(MissingRequirementError.scala:16)
    at scala.reflect.internal.MissingRequirementError$.notFound(MissingRequirementError.scala:17)
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:48)
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:40)
    at scala.reflect.internal.Mirrors$RootsBase.getModuleOrClass(Mirrors.scala:61)
    at scala.reflect.internal.Mirrors$RootsBase.getPackage(Mirrors.scala:172)
    at scala.reflect.internal.Mirrors$RootsBase.getRequiredPackage(Mirrors.scala:175)
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage$lzycompute(Definitions.scala:181)
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackage(Definitions.scala:181)
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass$lzycompute(Definitions.scala:182)
    at scala.reflect.internal.Definitions$DefinitionsClass.RuntimePackageClass(Definitions.scala:182)
    at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr$lzycompute(Definitions.scala:997)
    at scala.reflect.internal.Definitions$DefinitionsClass.AnnotationDefaultAttr(Definitions.scala:996)
    at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses$lzycompute(Definitions.scala:1126)
    at scala.reflect.internal.Definitions$DefinitionsClass.syntheticCoreClasses(Definitions.scala:1125)
    at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode$lzycompute(Definitions.scala:1169)
    at scala.reflect.internal.Definitions$DefinitionsClass.symbolsNotPresentInBytecode(Definitions.scala:1169)
    at scala.reflect.internal.Definitions$DefinitionsClass.init(Definitions.scala:1234)
    at scala.tools.nsc.Global$Run.(Global.scala:1281)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:87)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:72)
    at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:35)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4.compileScala$1(AggressiveCompile.scala:70)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
    at sbt.inc.Incremental$.cycle(Incremental.scala:45)
    at sbt.inc.Incremental$.compile(Incremental.scala:29)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
    at sbt.Compiler$.apply(Compiler.scala:79)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:572)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
    at sbt.std.Transform$$anon$5.work(System.scala:71)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:238)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
[error] (test:compile) scala.reflect.internal.MissingRequirementError: object scala.runtime in compiler mirror not found.
[error] Total time: 39 s, completed Apr 1, 2014 4:08:27 PM
play clean test  103.37s user 3.60s system 224% cpu 47.737 total

最近在用自制软件更新了一些软件包之后突然发生了这种情况,虽然我不确定是什么原因因为我卸载了homewbrew并且从他们的网站开始使用play zip软件包只是为了得到同样的问题。

我尝试过的其他事情:

  • 清除家中的.sbt,.ivy,.m2目录
  • 卸载/重新安装scala / play / java,使用play framework clean命令,清理repo等。

1 个答案:

答案 0 :(得分:0)

TL; DR我们依赖的powermock.jar文件不是jar文件。

我能够跑步"玩测试"在一个新的游戏项目中,但我的系统中没有一个比较成熟的项目。所以我决定删除文件,直到我通过测试。我首先删除了所有scala测试(我们混合使用了Java和Scala)并得到了这个更具信息量的错误:

[error] error: error reading /usr/local/Cellar/play/2.1.1/libexec/repository/cache/org.powermock/powermock-mockito-release-full/jars/powermock-mockito-release-full-1.5.jar; cannot read zip file

我看了一下jar文件:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <style type="text/css">
            html, body, #partner, iframe {
                height:100%;
                width:100%;
                margin:0;
                padding:0;
                border:0;
                outline:0;
                font-size:100%;
                vertical-align:baseline;
                background:transparent;
            }
            body {
                overflow:hidden;
            }
        </style>
        <meta content="NOW" name="expires">
        <meta content="index, follow, all" name="GOOGLEBOT">
        <meta content="index, follow, all" name="robots">
        <!-- Following Meta-Tag fixes scaling-issues on mobile devices -->
        <meta content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" name="viewport">
    </head>
    <body>
        <div id="partner"></div>
        <script type="text/javascript">
            document.write(
                    '<script type="text/javascript" language="JavaScript"'
                            + 'src="//sedoparking.com/frmpark/'
                            + window.location.host + '/'
                            + 'tierraexpired'
                            + '/park.js">'
                    + '<\/script>'
            );
        </script>
    </body>
</html>

我们依赖于powermock 1.5:

"org.powermock" % "powermock-mockito-release-full" % "1.5" % "test"

快速浏览一下powermock网站,似乎已经弃用了powermock 1.5,也许它已经被拉了。但我们实际上是从Artifactory提供此特定文件,无论出于什么原因,它开始提供HTML。

不确定为什么它没有通过签名验证或给我们提供更多信息错误。