Java 如何在eclipse中添加插件依赖
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2319340/
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
how to add plug in dependency in eclipse
提问by GuruKulki
I want to know why and how to add a plug in dependency for any project in eclipse.
我想知道为什么以及如何为 eclipse 中的任何项目添加插件依赖项。
采纳答案by Anthony Forloney
回答by ant
Click on the project , choose properties, go to Java Build Path .. add jars or add external jars should solve your problem.
单击项目,选择属性,转到 Java Build Path .. 添加 jars 或添加外部 jars 应该可以解决您的问题。
回答by Ribo
How to Resolve What Plugin to Add to the Dependencies
如何解决向依赖项添加什么插件
I needed to know what dependency to add (to an Eclipse Plug-in) as well as how to add it. The errors I got in the Java code were:
我需要知道要添加什么依赖项(到 Eclipse 插件)以及如何添加它。我在 Java 代码中遇到的错误是:
The type org.eclipse.jface.text.source.Annotation cannot be resolved. It is indirectly referenced from required .class files
in the java 'package' statement and:
在 java 'package' 语句中,并且:
The hierarchy of the type JavaDecodePlugin is inconsistent
To find what plugin supplied the Annotation class I searched the 'plugins' directory of the where the Eclipse code was installed on my (windows) machine (\app\androidDev\eclipse) for a reference to that class:
为了找到提供 Annotation 类的插件,我搜索了 Eclipse 代码安装在我的(windows)机器(\app\androidDev\eclipse)上的“plugins”目录,以获取对该类的引用:
C:\app\androidDev\eclipse\plugins>grep -r org.eclipse.jface.text.source.Annotation *
Binary file org.eclipse.jface.text_3.8.2.v20121126-164145.jar matches
Binary file org.eclipse.text_3.5.200.v20120523-1310.jar matches
it was referenced in two plugins/jars. I searched the jars for the desired class. The first plugin/jar didn't contain it, the second did.
它在两个插件/罐子中被引用。我在罐子里搜索了所需的课程。第一个插件/jar 不包含它,第二个包含。
C:\app\androidDev\eclipse\plugins>jar -tf org.eclipse.jface.text_3.8.2.v20121126-164145.jar |grep Annotations
org/eclipse/jface/text/link/LinkedPositionAnnotations.class
org/eclipse/jface/text/source/projection/ProjectionSupport$ProjectionAnnotationsPainter.class
C:\app\androidDev\eclipse\plugins>jar -tf org.eclipse.text_3.5.200.v20120523-1310.jar |grep Annotations
org/eclipse/jface/text/source/Annotation.class
org/eclipse/jface/text/source/AnnotationMap.class
org/eclipse/jface/text/source/AnnotationModel.class
org/eclipse/jface/text/source/AnnotationModel.class
org/eclipse/jface/text/source/AnnotationModel$AnnotationsInterator.class
org/eclipse/jface/text/source/AnnotationModel$InternalModelListener.class
org/eclipse/jface/text/source/AnnotationModel$MetaIterator.class
org/eclipse/jface/text/source/AnnotationModel$RegionIterator.class
org/eclipse/jface/text/source/AnnotationModel.class
org/eclipse/jface/text/source/AnnotationModelEvent.class
So I knew what plugin I needed now. As Plug-in Dependenciesshows (as in the answer above) You need to go to 'Package Explorer' expand 'META-INF', open 'MANIFEST.MF', open the 'Dependencies' tab and click the 'Add' button on the 'Required Plug-ins' section, type part of the name of the plug-in in the 'Select a Plug-in text area, let it find the fullname of the plugin (perhaps select the desired plugin) and click Ok.
所以我知道我现在需要什么插件。如插件依赖项所示(如上面的答案所示)您需要转到“包资源管理器”,展开“META-INF”,打开“MANIFEST.MF”,打开“依赖项”选项卡,然后单击“添加”按钮在“必需插件”部分,在“选择插件”文本区域中输入插件名称的一部分,让它找到插件的全名(也许选择所需的插件),然后单击“确定”。
(This answer is somewhat to document the process so if I have to do this again after I forget what I did, I, and you, will know)
(这个答案在某种程度上是为了记录这个过程,所以如果我在忘记我做了什么后必须再次这样做,我和你都会知道)