更改 sbt 的命令行版本的 Ivy 主目录非常简单。您只需将-Dsbt.ivy.home=<new ivy home dir>
选项添加到$SBT_HOME/conf/sbtconf.txt
。
我想对IntelliJ IDEA的Scala扩展做同样的事情(我的C盘上的磁盘空间不足)。因此,我按以下方式修改了SBT设置:文件 - &gt;其他设置 - &gt;默认设置 - &gt;构建,执行,部署 - &gt; BuildTools - &gt; SBT 。在 VM参数下,我添加了条目-Dsbt.ivy.home=<new ivy home dir>
。这应该与命令行工具具有相同的效果。
当我创建一个新的基于 sbt 的Scala项目(并添加一个打印出消息的Scala对象)时,一切似乎都很好用。我可以构建并运行该程序。但是在对源代码进行更改并使项目( Build - &gt; Make Project )两次或三次之后,我发现以下错误:
Error:scalac: Error: assertion failed:
Precisely this override requires its invoker to hand out a non-null AbstractFile.
while compiling: D:\Temp\scala\scalatest3\src\main\scala\Main.scala
during phase: jvm
library version: version 2.12.0
compiler version: version 2.12.0
reconstructed args: -nobootcp -javabootclasspath ; -classpath C:\Program Files\Java\jdk1.8.0_102\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\rt.jar;D:\temp\scala\scalatest3\target\scala-2.12\classes;D:\Bin\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.12.0.jar
last tree to typer: TypeTree(class ListBuffer)
tree position: line 4 of D:\Temp\scala\scalatest3\src\main\scala\Main.scala
tree tpe: scala.collection.mutable.ListBuffer[() => Unit]
symbol: final class ListBuffer in package mutable
symbol definition: final class ListBuffer extends AbstractBuffer with Buffer with GenericTraversableTemplate with BufferLike with ReusableBuilder with SeqForwarder with Serializable (a ClassSymbol)
symbol package: scala.collection.mutable
symbol owners: class ListBuffer
call site: constructor Main$delayedInit$body in class Main$delayedInit$body in package <empty>
== Source file context for tree position ==
1 * Created by P20058 on 14.11.2016.
2 */
3 object Main extends App {
4 println("Hello scalatest")
5
6 }
java.lang.AssertionError: assertion failed:
Precisely this override requires its invoker to hand out a non-null AbstractFile.
while compiling: D:\Temp\scala\scalatest3\src\main\scala\Main.scala
during phase: jvm
library version: version 2.12.0
compiler version: version 2.12.0
reconstructed args: -nobootcp -javabootclasspath ; -classpath C:\Program Files\Java\jdk1.8.0_102\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_102\jre\lib\rt.jar;D:\temp\scala\scalatest3\target\scala-2.12\classes;D:\Bin\.ivy2\cache\org.scala-lang\scala-library\jars\scala-library-2.12.0.jar
last tree to typer: TypeTree(class ListBuffer)
tree position: line 4 of D:\Temp\scala\scalatest3\src\main\scala\Main.scala
tree tpe: scala.collection.mutable.ListBuffer[() => Unit]
symbol: final class ListBuffer in package mutable
symbol definition: final class ListBuffer extends AbstractBuffer with Buffer with GenericTraversableTemplate with BufferLike with ReusableBuilder with SeqForwarder with Serializable (a ClassSymbol)
symbol package: scala.collection.mutable
symbol owners: class ListBuffer
call site: constructor Main$delayedInit$body in class Main$delayedInit$body in package <empty>
== Source file context for tree position ==
1 * Created by P20058 on 14.11.2016.
2 */
3 object Main extends App {
4 println("Hello scalatest34")
5
6 }
at scala.tools.nsc.backend.jvm.BytecodeWriters$ClassBytecodeWriter.writeClass(BytecodeWriters.scala:120)
at scala.tools.nsc.backend.jvm.BytecodeWriters$ClassBytecodeWriter.writeClass$(BytecodeWriters.scala:118)
at scala.tools.nsc.backend.jvm.BytecodeWriters$$anon$4.writeClass(BytecodeWriters.scala:47)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.sendToDisk$1(GenBCode.scala:408)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.drainQ3(GenBCode.scala:427)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.buildAndSendToDisk(GenBCode.scala:387)
at scala.tools.nsc.backend.jvm.GenBCode$BCodePhase.run(GenBCode.scala:350)
at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1404)
at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1389)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:1384)
at scala.tools.nsc.Global$Run.compile(Global.scala:1478)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)
at xsbt.CachedCompiler0.run(CompilerInterface.scala:94)
at xsbt.CompilerInterface.run(CompilerInterface.scala:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)
at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:67)
at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:24)
at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
重建项目( Build - &gt; Rebuild Project )有效。但是在一些 make 迭代之后,上面的错误再次出现。 我想念的任何想法?
答案 0 :(得分:0)
检查库,在我的情况下,我使用的是2个不同版本的测试库