Eclipse Java EE透视图看不见Referenced Libraries解决办法
一直使用Maven,工程中所有依赖的jar包都会在Maven Dependencies目录下,今天用Eclipse IDE for Java EE Developers(版本3.6)导入一个没有使用Maven管理的老项目,以往依赖的包都会在Referenced Libraries目录下,但在Java EE透视图居然所有的Jar包都在项目根目录下(如图),看起来非常不爽,需要解决这个问题。
事实上是笔者忽略了一个细节,即Project Explorer与Package Explorer的区别,在Package Explorer窗口中会出现Referenced Libraries,但Java EE 透视图中默认左边只有Project Explorer窗口。因此只要打开Package Explorer窗口即可,打开方法:菜单Window->Show View->Other->Java->Package Explorer,如果Package Explorer窗口中仍不见Referenced Libraries目录,则可以点击Package Explorer窗口右上角的倒三角箭头,在弹出的菜单中选择“Show 'Referenced Libraries' Node.” 。
Package Explorer窗口也可将项目分组,当项目超过10个时可以进行分组显示,设置过程是:
点击Package Explorer窗口右上角的倒三角箭头,在弹出的菜单中选择Top Level Elements->Working Sets
再在该菜单中点击Configure Working Sets,即会弹出分组编辑器。这里可以随意创建分组,创建和编辑分组时,同时可以将项目设定到该组下,完成后Package Explorer窗口中的顶级元素不再是项目了,而是创建的分组,分组下面才是真正的项目。
当然这是一篇很低级的博客,但居然也有和笔者一样一根筋的老外,文摘:
How do I hide Referenced Libraries in Eclipse's Java EE perspective?
Eclipse's normal Java perspective seems to hide Referenced Libraries just fine (in a "Referenced Libraries" folder in your project). Unfortunately, the Java EE perspective does not seem to have this same feature and enabling it is non-intuitive.
Can anyone shed some light on this issue?
Answer:
----------------------------------
The "Referenced Libraries" view is available in the Java perspective, in the Package Explorer view.
In the Java EE perspective, the Project Explorer view is the default (as opposed to the Package Explorer view). Therefore, if you wish to view the Referenced Libraries, you must open the Package Explorer view in the Java EE perspective.
Note that this view will not remove the user libraries that have been added to the project. The use of Referenced Libraries is primarily for user jars, or jars internal to the project, often placed under the lib directory of the project.
-----------------------------------
First, bring up the "Package Explorer" view (instead of the "Project Explorer" view).
Then, if the referenced .jar files still are visible in the root of the project, click on the little "down arrow" icon in the top-right corner of the Package Explorer view. In the context menu that appears, one of the items on the menu is "Show 'Referenced Libraries' Node." Click on that menu item.
关键词:Eclipse Helios Java EE perspective Referenced Libraries