我刚刚将 Apache POI 库从 3.9 升级到 4.0.1,同时还使用了 Apache 包 org.apache.servicemix.bundles.poi,它有很多更改和依赖项。我正在努力满足依赖项,但不断遇到缺少约束的问题。有没有人使用 org.apache.servicemix.bundles.poi/4.0.0_1 实现了 Apache POI???我被困在 osgi.wiring.package 上;(osgi.wiring.package=org.apache.xml.security.signature)
我收到此错误:
Error executing command: Could not start bundle mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi/4.0.0_1 in feature(s) fadec-application-1.0.0: Unresolved constraint in bundle org.apache.servicemix.bundles.poi [303]: Unable to resolve 303.0: missing requirement [303.0] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.security.signature)
如何使用 karaf osgi 容器并使其工作。太多不需要的依赖项和缺少的依赖项。
谢谢!
答案1
目前除了 3.9_2 以外,没有其他可以工作或成功部署到 OSGI karaf 容器的版本。你需要构建自己的版本。这是一个开始。
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ge.ip.poi</groupId>
<artifactId>poi-bundle</artifactId>
<version>3.1.7</version>
<packaging>bundle</packaging>
<name>POI OSGi-Bundle</name>
<description>This OSGi bundle wraps poi, poi-ooxml, poi-ooxml-schemas and poi-scratchpad jar files.</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
<!-- <dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.17</version>
</dependency> -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>ooxml-schemas</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.17</version>
</dependency>
<dependency>
<groupId>com.github.virtuald</groupId>
<artifactId>curvesapi</artifactId>
<version>1.06</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.18</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>stax</groupId>
<artifactId>stax-api</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<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>
<Export-Package>
org.apache.poi.*;-split-package:=merge-first
</Export-Package>
<!--
One important thing to note: if you are not exporting a package, you add it to the Private-Package instruction.
Otherwise, the classes inside the package will not be copied to your bundle, as the default value of this instruction is empty.
;-split-package:=merge-first,com.graphbuilder.curve || com.graphbuilder.geom, schemasMicrosoftComOfficeExcel.*
-->
<Private-Package>
org.apache.commons.*,
org.apache.xmlbeans.*,
com.graphbuilder.curve.*,
com.graphbuilder.geom.*,
com.graphbuilder.math.*,
com.graphbuilder.org.apache.harmony.awt.gl.*
</Private-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<!-- <Import-Package>*</Import-Package> -->
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>