如何在OSGi/Equinox/Eclipse中附加库包的源代码? [英] How do I attach the sources for a library bundle in OSGi/Equinox/Eclipse?
问题描述
我创建了commons-lang3
的库包,并且效果很好.我可以构建捆绑软件,添加依赖项,然后在我的插件中使用该捆绑软件中的所有类.
I created a library bundle for commons-lang3
and this works well. I can build the bundle, add a dependency and then use all the classes in this bundle in my plugins.
但是我在调试器中看不到源代码.
But I don't see the sources in the debugger.
为此库包创建源包的最简单方法是什么?
What is the simplest way to create a source bundle for this library bundle?
PS:库捆绑包是一个包含原始JAR文件的插件; Eclipse不会再次编译源代码,它只是将现有的JAR添加到类路径中.
PS: A library bundle is a plugin which contains the original JAR file; Eclipse doesn't compile the source again, it just adds the existing JAR to the classpath.
推荐答案
如果将源文件添加到其自己的jar中,则创建一个META-INF/MANIFEST.MF文件,其中包含"Eclipse-SourceBundle"条目,该条目指定了符号库捆绑包的名称.以下是我从Felix罐子得到的示例:
If you add the source files to their own jar then create a META-INF/MANIFEST.MF file with an 'Eclipse-SourceBundle' entry which specifies the symbolic name of your library bundle. Below is an example I have from the Felix jar:
Manifest-Version: 1.0
Eclipse-SourceBundle: org.apache.felix.main;version="4.0.1";roots:="."
Bundle-Version: 4.0.1
Bundle-Name: Apache Felix Framework
Bundle-ManifestVersion: 2
Bundle-Vendor: The Apache Software Foundation
Bundle-SymbolicName: org.apache.felix.main.source
要能够在Eclipse中查看源,请确保此源jar位于您的PDE目标中(Windows-> Preferences->插件开发-> TargetPlatform).如果您将Eclipse本身用作目标平台,则将其放到eclipse plugins文件夹中.
To be able to view the source in Eclipse make sure this source jar is in your PDE target (Windows->Preferences->Plugin Development->TargetPlatform). If your using Eclipse itself as the target platform just drop it in to your eclipse plugins folder.
这篇关于如何在OSGi/Equinox/Eclipse中附加库包的源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!