本文介绍了Apache Felix与Apache POI的配合使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将Apache POI导入Atlassian Jira插件以读取Excel文件.

I'm trying to import Apache POI to Atlassian Jira Plugin for reading excel files.

一开始,我只是添加

<dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>${poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>${poi.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${poi.version}</version>
    </dependency>

poi.version是3.14

poi.version is 3.14

然后,当我启动提供它的插件时

then when I started the plugin it gave

Unresolved constraint in bundle com.tezExtensions [165]: Unable to resolve 165.0: missing requirement [165.0] osgi.wiring.package; (osgi.wiring.package=com.sun.javadoc)

然后,我用一些在另一个StackOverflow问题 Apache POI打包捆绑软件的Pax考试问题

Then I edited pom with some instructions which I found on another StackOverflow question Pax Exam issue with Apache POI wrapped bundle

 <instructions>
                    <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                    <!-- Add package to export here -->
                    <Export-Package>com.sony.poc.api,</Export-Package>
                    <_exportcontents>
                        org.apache.poi.*;version=${poi.version},
                        org.openxmlformats.schemas.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficeExcel.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficeOffice.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficePowerpoint.*;version=${poi.schema.version},
                        schemasMicrosoftComVml.*;version=${poi.schema.version},
                        org.etsi.uri.*;version=${poi.security.version}
                    </_exportcontents>
                    <!-- Add package import here -->
                    <Import-Package>
                        com.sun.javadoc;resolution:=optional,
                        com.sun.tools.javadoc;resolution:=optional,
                        org.apache.crimson.jaxp;resolution:=optional,
                        org.apache.tools.ant;resolution:=optional,
                        org.apache.tools.ant.taskdefs;resolution:=optional,
                        org.apache.tools.ant.types;resolution:=optional,
                        junit.framework.*;resolution:=optional,
                        junit.textui.*;resolution:=optional,
                        org.junit.*;resolution:=optional,
                        org.apache.xml.security.*;resolution:=optional,
                        org.apache.jcp.xml.dsig.internal.dom.*;resolution:=optional,
                        org.springframework.osgi.*;resolution:="optional", org.eclipse.gemini.blueprint.*;resolution:="optional", *</Import-Package>
                    <DynamicImport-Package>
                        org.apache.xmlbeans.*,
                        schemaorg_apache_xmlbeans.*
                    </DynamicImport-Package>

使用此配置,我会收到此错误;

With this configuration, I get this error;

Unable to resolve 165.0: missing requirement [165.0] osgi.wiring.package; (osgi.wiring.package=org.apache.xml.resolver)

有人有主意吗?

推荐答案

最后,我找到了解决方案.

Finally, I found a solution.

我已将它们添加为依赖项

I have added these as dependency

 <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>${poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>${poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${poi.version}</version>
        <exclusions>
            <exclusion>
                <groupId>stax</groupId>
                <artifactId>stax-api</artifactId>
            </exclusion>
            <exclusion>
                <groupId>xml-apis</groupId>
                <artifactId>xml-apis</artifactId>
            </exclusion>
        </exclusions>
    </dependency>

    <dependency>
        <groupId>org.codehaus.woodstox</groupId>
        <artifactId>woodstox-core-asl</artifactId>
        <version>4.4.1</version>
    </dependency>

并且还将它们添加到Import-Package标签的内部

And also added these are to inside of Import-Package tag

*;resolution:=optional, com.ctc.wstx.stax.*

仅此而已.

这篇关于Apache Felix与Apache POI的配合使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 20:49