2017-02-10 3 views
1

私はMANIFEST.MFが自動生成されたプロジェクトで作業しています。 私はフェリックスコンソールで私のOSGiバンドルを展開するとき、私は依存関係の問題manifest.mfが自動生成されたときにインポートとエクスポートのパッケージを管理する方法

> 09.02.2017 08:15:16.258 *ERROR* [FelixDispatchQueue] xxx.core FrameworkEvent ERROR (org.osgi.framework.BundleException: Unresolved 
> constraint in bundle xxx.core [446]: Unable to resolve 446.1: missing 
> requirement [446.1] osgi.wiring.package; 
> (&(osgi.wiring.package=xxx.acs.commons.dispatcher)(version>=1.0.0)(!(version>=2.0.0)))) 
> org.osgi.framework.BundleException: Unresolved constraint in bundle 
> xxx.core [446]: Unable to resolve 446.1: missing requirement [446.1] 
> osgi.wiring.package; 
> (&(osgi.wiring.package=xxx.acs.commons.dispatcher)(version>=1.0.0)(!(version>=2.0.0))) 
> at 
> org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4095) 
> at org.apache.felix.framework.Felix.startBundle(Felix.java:2114) at 
> org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1368) 
> at 
> org.apache.felix.framework.FrameworkStartLevelImpl.run(FrameworkStartLevelImpl.java:308) 
> at java.lang.Thread.run(Thread.java:745) 

を見ることができ、このような問題の周りのすべてのソリューションは、インポートおよびエクスポートパッケージの変更を行うことが、プロジェクトでは、マニフェストが自動生成されてきていると言います。

この問題を解決する方法については、ご了承ください。

答えて

1

を使用してエクスポートパッケージを制御することができますがのmaven-バンドルプラグインを使用することができますプロジェクト。

その他の標準的なJavaライブラリの場合は、BND Toolsを使用します。これは、apiとしてもmaven-bundleプラグインによって使用されます。アパッチ・ポイ、必要なマニフェストエントリの追加を再パッケージ化のpom.xmlの

例:

<?xml version="1.0" encoding="ISO-8859-1"?> 
<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> 
    <version>3.13.1</version> 

    <properties> 
     <poi.version>3.13</poi.version> 
     <poi.schema.version>1.1</poi.schema.version> 
     <poi.security.version>1.0</poi.security.version> 
    </properties> 

    <groupId>your.group.id</groupId> 
    <artifactId>external-apache-poi</artifactId> 
    <packaging>bundle</packaging> 
    <name>external-apache-poi</name> 
    <description>Apache poi framework</description> 

    <build> 
    <plugins> 

     <plugin> 
     <groupId>org.apache.felix</groupId> 
     <artifactId>maven-bundle-plugin</artifactId> 
     <version>2.5.3</version> 
     <extensions>true</extensions> 
     <configuration> 
      <instructions> 
         <_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> 
         <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, 
          * 
         </Import-Package> 
         <DynamicImport-Package> 
          org.apache.xmlbeans.*, 
          schemaorg_apache_xmlbeans.* 
         </DynamicImport-Package> 

      <!-- bundle supplied resource prefixes --> 
      <Include-Resource>{maven-resources}</Include-Resource> 

      <!-- Do not inline jars, include as jar files --> 
      <!-- There are config files with same name will be overwritten --> 
      <Embed-Dependency>*;scope=compile;inline=false</Embed-Dependency> 


      </instructions> 
     </configuration> 
     </plugin> 
    </plugins> 
    </build> 
    <dependencies> 
     <!-- Embedded dependencies --> 
     <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> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>poi-scratchpad</artifactId> 
      <version>${poi.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>ooxml-schemas</artifactId> 
      <version>${poi.schema.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.poi</groupId> 
      <artifactId>ooxml-security</artifactId> 
      <version>${poi.security.version}</version> 
     </dependency> 
    </dependencies> 

</project> 
関連する問題