Java 编译后的 Eclipse maven 在 Eclipse 中看不到 target/classes 文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19460892/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 17:26:16  来源:igfitidea点击:

Eclipse maven after compile cannot see target/classes folder in Eclipse

javaeclipsemaven

提问by Dennis Ahaus

After doing mvn clean compile installi can not see any files in target/classes folder in eclipse. But when i have a look in filesystem the folder is there with compiled classes files inside. But when i start a unit test, it says "there is no target/classes folder"

这样做后,mvn clean compile install我在 eclipse 中的 target/classes 文件夹中看不到任何文件。但是当我查看文件系统时,文件夹就在那里,里面有编译好的类文件。但是当我开始单元测试时,它说“没有目标/类文件夹”

Any ideas ???

有任何想法吗 ???

采纳答案by Dennis Ahaus

Solution was: Right click project -> properties -> build path -> Source tab -> "Allow output folders for source folders" and add the output folder target/classes explicit to each source folder. This works for me and after adding all folders, project could be compiled and executed

解决方案是:右键单击项目-> 属性-> 构建路径-> 源选项卡->“允许源文件夹的输出文件夹”并将输出文件夹目标/类显式添加到每个源文件夹。这对我有用,添加所有文件夹后,可以编译和执行项目

回答by Morfic

From my experience it would seam that Eclipse does not monitor the file system for changes. So if you created your classes the you manually ran maven from command line, I suspect you'd have to right click your project in Eclipse (from the Navigator for example), and click refresh, and only after this you'll see the new files.

根据我的经验,Eclipse 不会监视文件系统的更改。因此,如果您创建了类并从命令行手动运行 maven,我怀疑您必须在 Eclipse 中右键单击您的项目(例如从导航器),然后单击刷新,只有在此之后您才会看到新的文件。

You could also install the m2eand the m2-wtpmaven plugins for Eclipse, and run your build process from inside Eclipse which should detect all the changes on the file system.

您还可以为 Eclipse安装m2em2-wtpmaven 插件,并从 Eclipse 内部运行您的构建过程,这应该检测文件系统上的所有更改。

回答by Rob Newton

Preferences -> General -> Workspace -> Refresh using native hooks or polling

Preferences -> General -> Workspace -> Refresh using native hooks or polling

When enabled, any changes made by external editors will be automatically discovered by the Workbench.

启用后,工作台将自动发现外部编辑器所做的任何更改。