简体   繁体   中英

how to add plug in dependency in eclipse

我想知道为什么以及如何为eclipse中的任何项目添加依赖插件。

单击项目,选择属性,转到Java Build Path ..添加jar或添加外部jar应解决您的问题。

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:

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:

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:

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.

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$1.class
org/eclipse/jface/text/source/AnnotationModel$2.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 Dependencies shows (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.

(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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM