[英]Scala compilation error in IntelliJ: could not find an output directory
IntelliJ IDEA(最新社區版本)無法編譯以下錯誤的dotty編譯器:
scala.reflect.internal.FatalError: Could not find an output directory for
/src/contrib/dotty/scala-backend/src/compiler/scala/tools/nsc/backend/ScalaPrimitivesOps.scala
in List(
(/src/contrib/dotty/compiler/test-resources,/src/contrib/dotty/compiler/target/scala-2.12/classes),
(/src/contrib/dotty/compiler/target/scala-2.12/resource_managed/main,/src/contrib/dotty/compiler/target/scala-2.12/classes),
(/src/contrib/dotty/compiler/target/scala-2.12/src_managed/main,/src/contrib/dotty/compiler/target/scala-2.12/classes),
(/src/contrib/dotty/compiler/test,/src/contrib/dotty/compiler/target/scala-2.12/classes),
(/src/contrib/dotty/compiler/src,/src/contrib/dotty/compiler/target/scala-2.12/classes))
顯然,代碼沒有任何問題,Dotty似乎可以使用sbt進行編譯,因為run
命令可以正常工作。 sbt項目是否需要做一些特殊的事情才能使用sbt進行IDEA編譯? 是引起這個錯誤嗎? 否則,此錯誤是什么意思?
重現
從以前的安裝中刪除任何設置后,請使用新安裝的IntelliJ IDEA。
使用git clone --recursive https://github.com/lampepfl/dotty
下載資源庫
確保已安裝最新版本的sbt
。 從項目的根目錄運行sbt managedSources
。
使用Oracle JDK 1.8 Import project from external model
sbt
類型的Import project from external model
將設置Import project from external model
IntelliJ。 否則保留默認值。
在項目瀏覽器中的項目上單擊鼠標右鍵,然后選擇“ Load/Unload Modules...
。 卸載除dotty
, dotty-compiler
, dotty-library
和dotty-interfaces
之外的所有模塊。 ( http://dotty.epfl.ch/docs/contributing/intellij-idea.html中列出的模塊)
在項目瀏覽compiler
,單擊“ compiler
。 在Build
菜單中,單擊Build Module 'dotty-compiler'
。
什么不能解決
它不能解決任何問題File
=> Invalidate Caches/Restart
。
它不會解決任何問題,無法使所有模塊保持加載狀態。
根據我的經驗,出現此類錯誤的原因之一是您是否已在shell中打開了輸出文件夾或類似的文件。 似乎IDEA有時會嘗試刪除整個文件夾,如果由於使用了文件夾而無法刪除整個文件夾,則會神秘地導致這種錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.