scala 输出路径在同一个模块错误之间共享
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18920334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Output path is shared between the same module error
提问by Alexandre Can?ado Cardoso
When I try to compile any class in my project I get the error below:
当我尝试编译项目中的任何类时,出现以下错误:
Error scala: Output path .../eval/target/test-classes is shared between: Module 'eval' tests, Module 'eval' tests
Output path .../eval/target/classes is shared between: Module 'eval' production, Module 'eval' production
Please configure separate output paths to proceed with the compilation.
I've seen how to set the output path in IDEA and I've done it. But as the error claims that it is shared between the same module I couldn't solve it.
我已经看到如何在 IDEA 中设置输出路径并且我已经完成了。但是由于错误声称它在同一个模块之间共享,我无法解决它。
Obs.: Using Maven and IntelliJ IDEA.
观察:使用 Maven 和 IntelliJ IDEA。
Please, can anyone help?
拜托,有人可以帮忙吗?
采纳答案by Alexandre Can?ado Cardoso
Problem solved!
问题解决了!
I have reset backward and forward my git repository many times and close-reopen idea after some of it. When finaly IDEA shows a red message at the right top while it was starting. It says something like: the project has already a eval module, and if I want to delete eval module. Yes, it was quite confusing, but I click on delete and my problem disappear. I guess that for some reason I become with 2 eval modules and it delete one of it solving output path error.
我已经多次向后和向前重置我的 git 存储库,并在其中一些之后关闭重新打开想法。最后,IDEA 在启动时会在右上角显示一条红色消息。它说的是:该项目已经有一个 eval 模块,如果我想删除 eval 模块。是的,这很令人困惑,但我点击删除,我的问题就消失了。我想由于某种原因,我变成了 2 个 eval 模块,它删除了其中一个来解决输出路径错误。
回答by Yonatan Maman
all you need to do is:
您需要做的就是:
- synchronize both modules (right click > Synchronize)
- re-import pom.xml for both modules (right click > Maven > Re Import)
- 同步两个模块(右键单击 > 同步)
- 为两个模块重新导入 pom.xml(右键单击 > Maven > 重新导入)
Enjoy
享受
回答by DreamFlasher
Set up the output paths for your modules to different directories, as explained here: https://www.jetbrains.com/idea/help/configuring-module-compiler-output.html
将模块的输出路径设置为不同的目录,如下所述:https: //www.jetbrains.com/idea/help/configuring-module-compiler-output.html
On Project "Open Module Settings" -> Modules -> Paths -> Output/Test path
On Project "Open Module Settings" -> Modules -> Paths -> Output/Test path
回答by Cory Klein
回答by Tomer Ben David
Files --> Invalidate caches and restart- Close intellij
- delete (extenrally from intellij)
.ideafolder (backuprunConfigurationsfolder if you have one). - delete the
project.imlfile - Open intellij
- Open the project again from
pomor fromsbt(or whatever source build tool you have.
Files --> Invalidate caches and restart- 关闭智能
- 删除(外部来自 intellij)
.idea文件夹(runConfigurations如果有备份文件夹)。 - 删除
project.iml文件 - 打开智能
- 从
pom或从sbt(或您拥有的任何源构建工具)再次打开项目。
回答by David Moles
I had this happen with the root module in a multi-module project. Since the root module was just a placeholder, it didn't actually contain any code, but IDEA still complained that it was sharing an output path ([project]/build) between test and production.
我在多模块项目中的根模块中发生了这种情况。由于根模块只是一个占位符,它实际上并不包含任何代码,但 IDEA 仍然抱怨它[project]/build在测试和生产之间共享输出路径 ( )。
The fix was to add
解决方法是添加
plugins {
id "java"
}
at the top of the root build.gradlefile (applying the otherwise unnecessary Java plugin) and reimporting the project. This allowed IDEA to pick up the Java-default [project]/build/classes/mainand [project]/build/classes/testoutput directories.
在根build.gradle文件的顶部(应用其他不必要的 Java 插件)并重新导入项目。这允许 IDEA 选择 Java-default[project]/build/classes/main和[project]/build/classes/testoutput 目录。
回答by bradley.ayers
Open up the module settings and look for errors. Fix said errors and everything should work.
打开模块设置并查找错误。修复上述错误,一切都应该正常工作。
回答by Dyin
For a Spark project, the IDE created _2.11versions of SBT modules. I had to delete them by hand.
对于 Spark 项目,IDE 创建_2.11了 SBT 模块的版本。我不得不手动删除它们。
回答by Pookly
Idea itself reports an error, the prompt is already very obvious, calm analysis can solve; Open Project Structure --> modules. Delete or reconfigure outputPath,The computer is the most honest
idea本身报错,提示已经很明显了,冷静分析即可解决;打开项目结构 --> 模块。删除或重新配置outputPath,电脑最老实
回答by salexinx
For gradle, I delete the .idea folder and reopen the project. Everything is recovery.
对于 gradle,我删除 .idea 文件夹并重新打开项目。一切都在恢复中。


