我有一个 Maven 项目泛光灯。它在 Eclipse 中运行良好。然后我使用 bundle-plugin 生成包并将所有依赖项嵌入到单个目标包中<embed-dependenciy>
。这是 pom.xml:
<groupId>net.floodlightcontroller</groupId>
<artifactId>floodlight</artifactId>
<version>master</version>
<packaging>bundle</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Bundle-Activator>net.floodlightcontroller.core.Activator</Bundle-Activator>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
</plugin>
</plugins>
<build>
我已经检查了目标结构。包括所有依赖项。然后我检查 manifest.mf:
Import-Package:
COM.jrockit.reflect,COM.newmonics.PercClassLoader,com.google.protobuf,com.informix.jdbc,
com.kenai.jnr.x86asm,groovy.lang,javax.annotation,javax.jms,javax.mail,
javax.mail.internet,javax.management,javax.naming,javax.net,javax.net.ssl,javax.script,
*
*
*
我想知道为什么它仍然导入这么多包,因为我已经将所有依赖项嵌入到单个包中。当我将捆绑包部署到 OSGi 容器并启动它时,出现错误:
Unable to start bundle 402: Unresolved constraint in bundle floodlight [402]:
Unable to resolve 402.0: missing requirement [402.0] osgi.wiring.package;
(osgi.wiring.package=COM.jrockit.reflect)
COM.jrockit.reflect 是导入包中列出的第一个包。但它没有在导出包中列出。运行时需要这个包吗?谁能帮我?