本文介绍了使用Ensime构建会删除所有.class文件,但不编译任何内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我很确定我已经设置了Emacs,Ensime,SBT和Scala来正常工作。我可以编辑文件,看到类型错误,当我保存并成功尝试使用ensime的自动重构工具。
问题是当我尝试构建我的项目。无论是否有任何错误,请按 Cc Cb b
给我输出:
最新编译结果(q退出,TAB跳转到下一个错误)
------------------------- ---------------
0错误,0警告。
然后我注意到REPL没有加载任何导致我问,但是我发现如果我通过从命令行调用 sbt compile
构建我的项目,我可以构建我的项目并使用REPL。
我也看到,在我使用 sbt compile
成功构建我的项目之后,然后尝试处理项目并调用增量构建( Cc Cb r
),我会得到:
异步RPC中止:增量构建器发生错误。检查服务器日志。
在迷你缓冲区中。这是出现在 * lower-ensime-server *
缓冲区中:
处理RPC:(swank:builder-update-files(nil))
错误处理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.immutable.List.foreach(List.scala:309)
scala.collection .SeqLike $ class.distinct(SeqLike.sca la: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 .includeClass :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)
写入:(:return(:abort 205增量构建器中出错。检查服务器日志。)44)
如果,我试图用 Cc Cb b
,我会得到原始缓冲区没有显示任何错误或警告(不管是否是这种情况),并且看到原来的类目录将被删除。 p>
为什么会发生这种情况,如何获得 Cc Cb b
和 Cc Cb r 以正确构建项目?
编辑:
看来类似的文件正在生成的目录中,我已经安装了 ensime
,这对我来说似乎很奇怪...
编辑2 :
我在中收到以下内容*消息*
在启动时我不知道这是否相关:
渴望宏扩展失败:(错误( class class class class class class class class class class class class class class class class class class class class class class class class class class class class class class class class class class =h2_ lin>解决方案
这些问题是由于bug的错误;两个都应该在当前的git树中修复:
I am pretty sure I have setup Emacs, Ensime, SBT, and Scala to work together properly. I am able to edit files and see type errors when I save and have successfully tried using ensime's autorefactoring tools.
The problem is when I try to build my project. Regardless of whether there are any errors are not, pressing C-c C-b b
gives me this output:
Latest Compilation Results (q to quit, TAB to jump to next error)
----------------------------------------
0 errors, 0 warnings.
Then I noticed the REPL wasn't loading anything which led me to ask this question, but I found out that if I built my project by calling sbt compile
from the command line, I could build my project and using the REPL was fine.
I also saw that after I sucessfully built my project with sbt compile
and then tried to work on the project and call "incremental build" (C-c C-b r
), I would get:
Asynchronous RPC Aborted: Error occurred in incremental builder. Check the server log.
in the mini-buffer. This is what appeared in the *inferior-ensime-server*
buffer:
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)
If, I tried to do a full build with C-c C-b b
, I would get the original buffer showing no errors or warnings (regardless of if that was the case or not) and see that the original class directory would be deleted.
Why is this happening and how can I get C-c C-b b
and C-c C-b r
to correctly build the project?
EDIT:
It seems like the class files are being generated inside of the directory where I have ensime
installed, which seems quite odd to me...
EDIT 2:
I am getting the following in *Messages*
at startup. I don't know if this is relevant:
Eager macro-expansion failure: (error "(ensime-builder-changed-files (ensime-connection)) is not a valid place expression") [3 times]
解决方案
These problems were due to bugs in ensime ; both should be fixed in the current git tree:
https://github.com/ensime/ensime-src.git
这篇关于使用Ensime构建会删除所有.class文件,但不编译任何内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!