问题描述
我们的一个插件需要一个安装的JDK,而不仅仅是一个JRE。我们需要com.sun.javadoc和tools.jar的朋友。我不认为Sun的许可证将允许重新分发tools.jar(如果您已经有JDK,则不需要)。Eclipse中似乎还没有办法指定一个JDK作为依赖关系。 Eclipse新闻组中的所有答案都表明最终用户必须首先正确配置Eclipse。
您是否知道任何解决方法会使这种依赖关系对我们的插件的用户显而易见,只是通过使用Eclipse的板载机制来实现依赖关系?似乎这个软件包对于清单中的 Import-Package
来说是不合适的。 com.sun.jdi。
(作为一个解决方法,目前我们只能警告插件激活该库缺失。)
$ b $由于eclipse提供了一个OSGi环境,你可以参考文章,并尝试使用:- a系统包声明
- 扩展包(片段)声明
- 或引导委派
通过指定您需要的JDK软件包,OSGI框架将尝试加载它们(如果没有,则失败)。
通过指定一个JDK5或JDK6,您甚至可以确保JDK的正确版本。
org.osgi.framework .system.packages = \
javax.accessibility,\
javax.activity,\
javax.crypto,\
javax.crypto.interfaces,\
...
org.xml.sax.helpers
org.osgi.framework.system.packages = \
javax.accessibility,\
javax.activity,\
...
org.xml.sax.helpers,\
special.parent.package
注意:指定仅适用于JRE,而不是JDK ...
这种配置需要是Equinox框架的config.ini的一部分(请参阅及其)。
在您的情况下,它将在您的片段的config.ini中声明。
One of our plugins requires an installed JDK, not just an JRE. We need com.sun.javadoc and friends from tools.jar. I do not think Sun's license will allow redistributing tools.jar (which is not necessary if you already have a JDK anyway).
It also seems there is no way in Eclipse to specify a JDK as a dependency. All answers in the Eclipse newsgroups suggest that end users will have to configure their Eclipse properly first.
Do you know any workaround that will make this dependency obvious to users of our plugin, just by using Eclipse's on-board mechanisms for dependencies? It seems this package is not even valid for Import-Package
in the manifest, unlike e.g. com.sun.jdi.
(As a work-around, currently we can only warn on plugin activation that this library is missing.)
Since eclipse offers an OSGi environment, you could refer to the article "Exposing the boot classpath in OSGi", and try using:
- a System Packages declaration
- a Extension Bundles (Fragment) declaration
- or boot delegation
By specifying the JDK packages you need, the OSGI framework will attempt to load them (and fail if there are not here).
By specifying one specific to JDK5 or JDK6, you could even ensure the right version of the JDK.
org.osgi.framework.system.packages = \
javax.accessibility,\
javax.activity,\
javax.crypto,\
javax.crypto.interfaces,\
…
org.xml.sax.helpers
org.osgi.framework.system.packages = \
javax.accessibility,\
javax.activity,\
…
org.xml.sax.helpers, \
special.parent.package
Note: the simpler solution of specifying Bundle-RequiredExecutionEnvironment
is only for the JRE, not the JDK...
That kind of configuration need to be part of the config.ini of the Equinox framework (see this example for Jetty and its config.ini).
In your case, it would be declared in the config.ini of your fragment.
这篇关于取决于Eclipse中的tools.jar(Sun JDK)中的com.sun.javadoc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!