我想知道为什么以及如何在Eclipse中为任何项目添加插件依赖。
The type org.eclipse.jface.text.source.Annotation cannot be resolved. It is indirectly referenced from required .class files
The hierarchy of the type JavaDecodePlugin is inconsistent
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
这个类被两个插件/ JAR文件引用。我在这些文件中搜索了需要的类。第一个插件/ 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$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
所以我现在知道需要哪个插件了。就像Plug-in Dependencies中所示(如上面的答案所示),您需要进入“包资源管理器”,展开“META-INF”,打开“MANIFEST.MF”,打开“依赖项”选项卡,然后在“必需插件”部分的“添加”按钮上点击,在“选择插件”文本区域中键入插件名称的一部分,让它找到插件的全名(也许选择所需的插件),然后单击“确定”。
(此答案有点像记录过程,以便如果我忘记了自己做了什么,我和您都会知道)