使用Ensime构建会删除所有.class文件,但不会编译任何内容

时间:2014-02-04 23:48:20

标签: scala emacs ensime

我很确定我已经将Emacs,Ensime,SBT和Scala设置为正常协同工作。我可以在保存时编辑文件并查看类型错误,并成功尝试使用ensime的自动重构工具。

问题是当我尝试构建我的项目时。无论是否有任何错误,按C-c C-b b都会给我输出结果:

Latest Compilation Results (q to quit, TAB to jump to next error)
----------------------------------------

0 errors, 0 warnings.

然后我注意到REPL没有加载任何导致我问this question的东西,但我发现如果我通过从命令行调用sbt compile来构建我的项目,我可以构建我的项目和使用REPL很好。

我也看到在用sbt compile成功构建项目然后尝试处理项目并调用“incremental build”(C-c C-b r)之后,我会得到:

Asynchronous RPC Aborted: Error occurred in incremental builder. Check the server log.

在迷你缓冲区中。这是*inferior-ensime-server*缓冲区中出现的内容:

Handling RPC: (swank:builder-update-files (nil))
Error handling RPC: java.lang.NullPointerException :
scala.reflect.internal.util.BatchSourceFile.hashCode(SourceFile.scala:170)
scala.collection.mutable.FlatHashTable$HashUtils$class.elemHashCode(FlatHashTable.scala:392)
scala.collection.mutable.HashSet.elemHashCode(HashSet.scala:41)
scala.collection.mutable.FlatHashTable$class.containsEntry(FlatHashTable.scala:124)
scala.collection.mutable.HashSet.containsEntry(HashSet.scala:41)
scala.collection.mutable.HashSet.contains(HashSet.scala:58)
scala.collection.GenSetLike$class.apply(GenSetLike.scala:43)
scala.collection.mutable.AbstractSet.apply(Set.scala:45)
scala.collection.SeqLike$$anonfun$distinct$1.apply(SeqLike.scala:490)
scala.collection.immutable.List.foreach(List.scala:309)
scala.collection.SeqLike$class.distinct(SeqLike.scala:489)
scala.collection.AbstractSeq.distinct(Seq.scala:40)
scala.tools.nsc.Global$Run.compileSources(Global.scala:1531)
scala.tools.nsc.Global$Run.compileFiles(Global.scala:1643)
scala.tools.nsc.interactive.RefinedBuildManager.update0$1(RefinedBuildManager.scala:133)
scala.tools.nsc.interactive.RefinedBuildManager.update(RefinedBuildManager.scala:188)
scala.tools.nsc.interactive.RefinedBuildManager.update(RefinedBuildManager.scala:102)
org.ensime.server.IncrementalBuilder$$anonfun$act$1$$anonfun$apply$mcV$sp$1.liftedTree1$1(IncrementalBuilder.scala:124)
org.ensime.server.IncrementalBuilder$$anonfun$act$1$$anonfun$apply$mcV$sp$1.applyOrElse(IncrementalBuilder.scala:93)
scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
scala.actors.InternalActor$class.receive(InternalActor.scala:123)
org.ensime.server.IncrementalBuilder.receive(IncrementalBuilder.scala:55)
org.ensime.server.IncrementalBuilder$$anonfun$act$1.apply$mcV$sp(IncrementalBuilder.scala:88)
org.ensime.server.IncrementalBuilder$$anonfun$act$1.apply(IncrementalBuilder.scala:87)
org.ensime.server.IncrementalBuilder$$anonfun$act$1.apply(IncrementalBuilder.scala:87)
scala.actors.Reactor$class.seq(Reactor.scala:285)
org.ensime.server.IncrementalBuilder.seq(IncrementalBuilder.scala:55)
scala.actors.Reactor$$anon$3.andThen(Reactor.scala:263)
scala.actors.Combinators$class.loop(Combinators.scala:28)
org.ensime.server.IncrementalBuilder.loop(IncrementalBuilder.scala:55)
scala.actors.Combinators$$anonfun$loop$1.apply(Combinators.scala:28)
scala.actors.Combinators$$anonfun$loop$1.apply(Combinators.scala:28)
scala.actors.Reactor$$anonfun$seq$1$$anonfun$apply$1.applyOrElse(Reactor.scala:282)
scala.runtime.AbstractPartialFunction.apply(AbstractPartialFunction.scala:33)
scala.actors.ReactorTask.run(ReactorTask.scala:31)
scala.actors.ReactorTask.compute(ReactorTask.scala:63)
scala.concurrent.forkjoin.RecursiveAction.exec(RecursiveAction.java:160)
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:262)
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:915)
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:980)
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1478)
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)

Writing: (:return (:abort 205 "Error occurred in incremental builder. Check the server log.") 44)

如果,我尝试使用C-c C-b b进行完整构建,我会得到原始缓冲区,显示没有错误或警告(无论是否是这种情况)并且看到原始类目录将是删除。

为什么会发生这种情况?如何让C-c C-b bC-c C-b r正确构建项目?

修改

似乎类文件是在我安装ensime的目录中生成的,这对我来说似乎很奇怪......

编辑2

我在启动时在*Messages*中收到以下内容。我不知道这是否相关:

Eager macro-expansion failure: (error "(ensime-builder-changed-files (ensime-connection)) is not a valid place expression") [3 times]

1 个答案:

答案 0 :(得分:0)

这些问题是由于随之而来的错误;两者都应该在当前的git树中修复:

https://github.com/ensime/ensime-src.git