这是我父母 pom 的一部分:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
</instructions>
</configuration>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.ops4j</groupId>
<artifactId>maven-pax-plugin</artifactId>
<version>1.4</version>
</plugin>
.
.
.
<modules>
<module>cross-annotations</module>
<module>cross-main</module>
<module>cross-event</module>
<module>cross-exception</module>
<module>cross-ui</module>
<module>cross-tools</module>
<module>cross-main-api</module>
<module>cross-math</module>
</modules>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>0.10.6</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.netbeans.api</groupId>
<artifactId>org-openide-util-lookup</artifactId>
<version>RELEASE71</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.6.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jul-to-slf4j</artifactId>
<version>1.6.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.osgi.core</artifactId>
<version>1.0.0</version>
<!-- this is provisional, eventually, osgi.core should be provided by the runtime container -->
<scope>provided</scope>
</dependency>
</dependencies>
当我使用 mvn pax:provision 运行它时,我会收到类似的错误
org.osgi.framework.BundleException: Unresolved constraint in bundle cross-annotations [4]: Unable to resolve 4.0: missing requirement [4.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&(osgi.wiring.package=org.slf4j.impl)(version>=1.6.0))]g!
或者
Unresolved constraint in bundle cross-ui [21]: Unable to resolve 21.0: missing requirement [21.0] osgi.wiring.package; (&(osgi.wiring.package=org.apache.commons.configuration)(version>=1.6.0)(!(version>=2.0.0))) [caused by: Unable to resolve 9.0: missing requirement [9.0] osgi.wiring.package; (osgi.wiring.package=javax.mail.internet)]
当然会抛出异常,因为所需的要求没有安装在 OSGi 容器中,但我认为这是 pax:provision 的目的。
所以正是我的问题:是否可以使用 pax 工具或任何其他 mvn 插件自动解决 OSGi 依赖关系?