在 Eclipse 文件夹中显示为包

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

In Eclipse folders appear as packages

eclipseidepackage

提问by DubyaDubyaDubyaDot

I'm getting an issue where non-src folders are looking like packages, they look completely fine in my natural folder directory.

我遇到一个问题,非 src 文件夹看起来像包,它们在我的自然文件夹目录中看起来完全没问题。

image

图片

The assets folder should be a hierarchy, but isn't.

资产文件夹应该是一个层次结构,但不是。

Thought it was because I was in package explorer but not project explorer, same issue with project explorer.

以为是因为我在包浏览器中而不是在项目浏览器中,与项目浏览器相同的问题。

回答by sbegaudeau

I believe, you right click on your project and choose "Build Path" and "Use as source folder". If it is the case, you can revert the problem by right clicking on your project and selecting "Build Path" and then "Remove from build path".

我相信,您右键单击您的项目并选择“构建路径”和“用作源文件夹”。如果是这种情况,您可以通过右键单击您的项目并选择“构建路径”,然后选择“从构建路径中删除”来恢复问题。

回答by David Tonhofer

For me the following worked (in RAD actually): Go to "Project Properties" / "Java Build Path" and mark the Resource Folder as "Source folders on the build path".

对我来说,以下工作(实际上在 RAD 中):转到“项目属性”/“Java 构建路径”并将资源文件夹标记为“构建路径上的源文件夹”。

Project Window 1

项目窗口 1

The Resource Folder (here, src/main/resources) appears as filled with classless packages:

资源文件夹(此处为src/main/resources)显示为充满了无类包:

Classless packages appear

无类包出现

Enter the exlcusion pattern "**" to exclude any source path:

输入排除模式“**”以排除任何源路径:

Project Window 2

项目窗口 2

This solves the problem.

这解决了问题。

Just folders now

现在只是文件夹

回答by ?smail Yavuz

Maven Update fixed my problem easily.

Maven Update 轻松解决了我的问题。

Right click on project,

右键单击项目,

maven->Update Project

I suspect that the cause was I run maven commands from command prompt (cmd) directly.

我怀疑原因是我直接从命令提示符(cmd)运行 maven 命令。