apache 精简和/或了解动态 Web 项目中的 Eclipse 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/478985/
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
Slim down and/or understand the Eclipse files in a Dynamic Web Project
提问by
The files residing in .settings in a Dynamic Web Projectare:
动态 Web 项目中 .settings 中的文件是:
.settings/
|-- org.eclipse.jdt.core.prefs
|-- org.eclipse.jst.common.project.facet.core.prefs
|-- org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs
|-- org.eclipse.wst.common.component
|-- org.eclipse.wst.common.project.facet.core.xml
|-- org.eclipse.wst.jsdt.ui.superType.container
|-- org.eclipse.wst.jsdt.ui.superType.name
`-- org.eclipse.wst.validation.prefs
The above file list is pretty much a clean new Dynamic Web Project, except that I'm using the IvyDE plug in, but I think it only affects the .classpath file.
上面的文件列表几乎是一个全新的动态 Web 项目,只是我使用的是 IvyDE 插件,但我认为它只影响 .classpath 文件。
How do I learn more about these files? I'm wondering if I can get rid of any of them without loosing something important?Finding this information at Eclipse.org was not very easy, a link or an explanation would be very welcome.
我如何了解有关这些文件的更多信息?我想知道我是否可以在不丢失重要东西的情况下摆脱它们中的任何一个?在 Eclipse.org 上找到这些信息并不容易,非常欢迎提供链接或解释。
I'm trying to learn more about these files as I want to slim down the Eclipse files as much as possible before I check them into version control.
我正在尝试了解有关这些文件的更多信息,因为我想在将 Eclipse 文件签入版本控制之前尽可能地精简它们。
In case it helps I list the above files and their contents:
如果有帮助,我列出了上述文件及其内容:
org.eclipse.jdt.core.prefs:
org.eclipse.jdt.core.prefs:
#Mon Jan 26 03:01:22 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jst.common.project.facet.core.prefs:
org.eclipse.jst.common.project.facet.core.prefs:
#Mon Jan 26 03:01:22 CET 2009
classpath.helper/org.eclipse.jdt.launching.JRE_CONTAINER\:\:org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType\:\:java-6-sun-1.6.0.07/owners=jst.java\:5.0
eclipse.preferences.version=1
org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs:
org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs:
#Mon Jan 26 03:23:25 CET 2009
XDOCLETBUILDERACTIVE=false
XDOCLETHOME=
XDOCLETUSEGLOBAL=false
XDOCLETVERSION=1.2.1
eclipse.preferences.version=1
org.eclipse.wst.common.component:
org.eclipse.wst.common.component:
<?xml version="1.0" encoding="UTF-8"?>
<project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="webcookie">
<wb-resource deploy-path="/" source-path="/src/main/webapp"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="webcookie"/>
<property name="java-output-path"/>
</wb-module>
</project-modules>
org.eclipse.wst.common.project.facet.core.xml:
org.eclipse.wst.common.project.facet.core.xml:
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="jst.java"/>
<fixed facet="jst.web"/>
<installed facet="jst.java" version="5.0"/>
<installed facet="jst.web" version="2.5"/>
</faceted-project>
org.eclipse.wst.jsdt.ui.superType.container:
org.eclipse.wst.jsdt.ui.superType.container:
org.eclipse.wst.jsdt.l
org.eclipse.wst.validation.prefs:
org.eclipse.wst.validation.prefs:
#Mon Jan 26 03:31:54 CET 2009
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_MANUAL_PREFERENCE=enaunching.baseBrowserLibrary
org.eclipse.wst.jsdt.ui.superType.name:
org.eclipse.wst.jsdt.ui.superType.name:
Window
org.eclipse.wst.validation.prefs:
org.eclipse.wst.validation.prefs:
#Mon Jan 26 03:31:54 CET 2009
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.jst.j2ee.internal.classpathdep.ClasspathDependencyValidator;org.eclipse.wst.common.componentcore.internal.ModuleCoreValidator;org.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_PREFERENCE=overrideGlobalPreferencesfalse
eclipse.preferences.version=1
override=false
suspend=false
vf.version=3
采纳答案by VonC
Let's see:
让我们来看看:
org.eclipse.jdt.core.prefsis really important and control how you compile your java project.org.eclipse.jst.common.project.facet.core.prefsadds a Facet, basically a way to introduce functionality to projects in Eclipse, therefore a project can have one or more facets (ie. it could be a Java project and a EJB project). See here for illustration(search the word 'Facet')org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefsis a way to Configuring XDoclet annotation supportorg.eclipse.wst.common.componentis relate to the deployment structure.org.eclipse.wst.common.project.facet.core.xmlis used to Specifying target servers for J2EE projectsorg.eclipse.wst.validation.prefsrefers to Wst validationorg.eclipse.wst.jsdt.ui.superType.container/nameas explained here, is a configuration for JSDT part:By default, plain javascript files (.js) inherit members from object Global. HTML files contained in a static/dynamic web project inherit members from object Window.
So if your context is a plain javaScript file it will appear that only Window.window or Window.alert(..) is valid since none of the Window members are inherited. What you really want is to inherit this field + method from an instance of the Window object.
,
The JSDT supports a configurable super type at the project level. Each .js or .html file within a project inherits all the fields and methods from the projects super type. By default the type is Global for standalone JavaScript projects and Window for Static/Dynamic Web Projects.
,
You can change the super type for a project from the JavaScript Include Path properties page from Object Global to Object Window to achieve the results you desire... On the Global Order/SuperType page change the Super Type to Window in the ECMA library.
org.eclipse.jdt.core.prefs非常重要,可以控制您编译 Java 项目的方式。org.eclipse.jst.common.project.facet.core.prefs添加一个Facet,基本上是一种向 Eclipse 中的项目引入功能的方法,因此一个项目可以有一个或多个方面(即它可以是一个 Java 项目和一个 EJB 项目)。参见此处的说明(搜索“Facet”一词)org.eclipse.jst.j2ee.ejb.annotations.xdoclet.prefs是一种配置 XDoclet 注释支持的方法org.eclipse.wst.common.component与部署结构有关。org.eclipse.wst.common.project.facet.core.xml用于为 J2EE 项目指定目标服务器org.eclipse.wst.validation.prefs指的是Wst 验证org.eclipse.wst.jsdt.ui.superType.container/name如此处所述,是 JSDT 部分的配置:默认情况下,纯 javascript 文件 (.js) 从对象 Global 继承成员。包含在静态/动态 Web 项目中的 HTML 文件从对象 Window 继承成员。
因此,如果您的上下文是一个普通的 javaScript 文件,那么似乎只有 Window.window 或 Window.alert(..) 是有效的,因为没有继承任何 Window 成员。您真正想要的是从 Window 对象的实例继承此字段 + 方法。
,
JSDT 在项目级别支持可配置的超类型。项目中的每个 .js 或 .html 文件都继承了项目超类型的所有字段和方法。默认情况下,独立 JavaScript 项目的类型为 Global,静态/动态 Web 项目的类型为 Window。
,
您可以从 JavaScript Include Path 属性页面将项目的超类型从 Object Global 更改为 Object Window 以实现您想要的结果...在 Global Order/SuperType 页面上将 Super Type 更改为 ECMA 库中的 Window。
回答by Markus Lausberg
You should use and trust the "Dependencies" tab in the MANIFEST.MF. After working about a year with Eclipse plugins only i would not try to find out which eclipse plugin dependency is necessary or not.
您应该使用并信任 MANIFEST.MF 中的“依赖项”选项卡。在仅使用 Eclipse 插件工作一年后,我不会尝试找出需要或不需要哪个 Eclipse 插件依赖项。
When you miss a plugin which is needed at runtime, you get exceptions which are not very useful and solutions are not obvious.
当您错过了运行时需要的插件时,您会得到非常有用的异常并且解决方案并不明显。
The MANIFEST actions "Find unused dependencies" should selected every time you refactor your code. It also helps to check the classes, eclipse will create, when you generate complete new plugin from scratch. The eclipse plugins are not good documented, so i would use the actions which are offered and dont spend so many times to understand them all.
每次重构代码时都应选择清单操作“查找未使用的依赖项”。当您从头开始生成完整的新插件时,它还有助于检查 Eclipse 将创建的类。eclipse 插件没有很好的文档记录,所以我会使用提供的操作,不要花太多时间来理解它们。
If you realy want to find out which plugins are used, when you create a plugin from scratch, you can delete some extend declarations or variables and press the "Find unused dependencies" action to see, which plugin is for a call.
如果你真的想找出使用了哪些插件,当你从头开始创建一个插件时,你可以删除一些扩展声明或变量,然后按“查找未使用的依赖项”操作来查看哪个插件用于调用。

