Resolve a dependency on package sun.misc with Tycho

风流意气都作罢 提交于 2019-12-05 02:12:48

问题


I try to convert a Buckminster-based build to Tycho (0.19.0). In our (mirrored) target platform we have the bundle com.lmax.disruptor from http://lmax-exchange.github.io/disruptor/ which imports the package "sun.misc"

When I try to build our own bundle (that depends on com.lmax.disruptor) I get:

[ERROR] Missing requirement: com.lmax.disruptor 3.2.0 requires 'package sun.misc 0.0.0' but it could not be found

I checked many Tycho tutorials but none of them contained such a dependency. Is there a way to import that package e.g., from the executing JRE?

Workaround:

When I add the disruptor bundle as a library to my bundle then it works without problems. But this seams more like a workaround because I will have other bundles that depend on it too.


回答1:


The problem is that none of the standard OSGi execution environments exposes the package sun.misc, so the bundle using this package will not work on a standard OSGi runtime. This is what the build failure is telling you.

So if you had a standard OSGi runtime (note that Equinox is special here because of its osgi.compatibility.bootdelegation option), you'd need to tell the OSGi runtime to expose additional packages from the boot class path. A way to do this (so that Tycho also understands your intention) is to build a system bundle fragment which declares an Export-Package of sun.misc.

This has been reported to work, but I haven't tried this myself.



来源:https://stackoverflow.com/questions/20469049/resolve-a-dependency-on-package-sun-misc-with-tycho

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!