Eclipse:如何使目录树显示为包
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4559350/
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
Eclipse: how to make directory trees show as packages
提问by bmargulies
In a typical project of mine, I have several source directories, each with the usual special icon in the package explorer.
在我的一个典型项目中,我有几个源目录,每个目录在包浏览器中都有一个常用的特殊图标。
Since these are maven projects, some are full of Java code, and some are full of resources.
由于这些是maven项目,有的全是Java代码,有的全是资源。
Some of the resource trees show the subdirs as packages, but others just show them as folders.
一些资源树将子目录显示为包,但其他资源树仅将它们显示为文件夹。
Anyone know how to get them all to show as packages?
任何人都知道如何让它们全部显示为包?
回答by WReach
In the Package Explorer, right-click on the folder and choose Build Path/ Use As Source Folder. The contents of that folder will now be included in the Eclipse build, however.
在 Package Explorer 中,右键单击该文件夹并选择Build Path/ Use As Source Folder。但是,该文件夹的内容现在将包含在 Eclipse 构建中。
Edit
编辑
If it is a nested folder, it has probably been excluded from the build. If so, you can choose Build Path/ Include-- but once again it will now be part of the build. An included subfolder can be excluded again using Build Path/ Exclude.
如果它是嵌套文件夹,则它可能已从构建中排除。如果是这样,您可以选择构建路径/包含——但它现在将再次成为构建的一部分。可以使用Build Path/ Exclude再次排除包含的子文件夹。
回答by DhruvKalaria
Run mvn eclipse:eclipse
from your root of project. It solved for me.
mvn eclipse:eclipse
从您的项目根目录运行。它为我解决了。