简体   繁体   English

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

[英]Eclipse maven after compile cannot see target/classes folder in Eclipse

After doing mvn clean compile install i can not see any files in target/classes folder in eclipse. 做完mvn clean compile install后,在eclipse中看不到target / classes文件夹中的任何文件。 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" 但是,当我开始单元测试时,它说“没有目标/类文件夹”

Any ideas ??? 有任何想法吗 ???

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 这适用于我,在添加所有文件夹后,可以编译和执行项目

From my experience it would seam that Eclipse does not monitor the file system for changes. 根据我的经验,Eclipse不会监视文件系统的更改。 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. 因此,如果您创建了类,则从命令行手动运行maven,我怀疑您必须在Eclipse中右键单击您的项目(例如,从Navigator中),然后单击“刷新”,只有在此之后您才会看到新的文件。

You could also install the m2e and the m2-wtp maven plugins for Eclipse, and run your build process from inside Eclipse which should detect all the changes on the file system. 您还可以为Eclipse安装m2em2-wtp maven插件,并从Eclipse内部运行构建过程,该过程应检测文件系统上的所有更改。

Preferences -> General -> Workspace -> Refresh using native hooks or polling 首选项 - >常规 - >工作区 - >使用本机挂钩或轮询刷新

When enabled, any changes made by external editors will be automatically discovered by the Workbench. 启用后,Workbench将自动发现外部编辑器所做的任何更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM