0

我在 gradle 中添加了外部依赖项,并在 bnd.bnd 文件中添加了外部依赖项,当我部署捆绑包时出现以下错误

07:28:41,922 WARN  [fileinstall-/home/bhagwan/televisory-benchmark-revamp/liferay-ce-portal-7.0-ga4/osgi/modules][org_apache_felix_fileinstall:103] Error while starting bundle: file:/home/bhagwan/televisory-benchmark-revamp/liferay-ce-portal-7.0-ga4/osgi/modules/com.compass.api.jar 
org.osgi.framework.BundleException: Could not resolve module: com.compass.api [533]_  Unresolved requirement: Import-Package: com.sun.javadoc_ [Sanitized]
    at org.eclipse.osgi.container.Module.start(Module.java:429)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1253)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1225)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
    at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:312)
07:28:41,922 IN

在 bnd 中包含 lib,如下所示:

-includeresource:\
    lib/poi-3.11.jar=poi-3.11.jar,\
    lib/poi-ooxml-3.11.jar=poi-ooxml-3.11.jar,\
    lib/commons-codec-1.9.jar=commons-codec-1.9.jar,\
    lib/poi-ooxml-schemas-3.11.jar=poi-ooxml-schemas-3.11.jar,\
    lib/xmlbeans-2.6.0.jar=xmlbeans-2.6.0.jar,\
    lib/stax-api-1.0.1.jar=stax-api-1.0.1.jar,\
    lib/junit-4.11.jar=junit-4.11.jar



Bundle-ClassPath:\
  .,\
   lib/poi-3.11.jar,\
   lib/poi-ooxml-3.11.jar,\
   lib/commons-codec-1.9.jar,\
   lib/poi-ooxml-schemas-3.11.jar,\
   lib/xmlbeans-2.6.0.jar,\
   lib/stax-api-1.0.1.jar,\
   lib/junit-4.11.jar
4

1 回答 1

1

添加的 lib(s) 必须依赖于包,因此 Bnd 为包添加了导入。您可以尝试通过将以下内容添加到 bnd.bnd 文件来使依赖项成为可选:

Import-Package: the.package.name;resolution:=optional, *

注意,final*很重要,这样 Bnd 将继续为其他包生成必要的包导入。

于 2017-08-30T15:23:59.567 回答