2016-03-16 35 views
0

我試圖部署具有依賴於一個名爲「utils的」組件添加作爲這樣的功能部件的功能:在Karaf功能啓動組件

<feature name="gc-utils" version="${version}"> 

     <bundle>mvn:org.eclipse.paho/org.eclipse.paho.client.mqttv3/1.0.2</bundle> 
     <bundle>mvn:log4j/log4j/1.2.17</bundle> 
     <bundle>mvn:commons-configuration/commons-configuration/1.10</bundle> 
     <bundle>mvn:commons-beanutils/commons-beanutils/1.9.2</bundle> 
     <bundle>mvn:org.slf4j/slf4j-log4j12/1.7.12</bundle> 
     <bundle>mvn:org.apache.commons/commons-lang3/3.1</bundle> 
     <bundle>mvn:com.google.code.gson/gson/2.4</bundle> 
     <bundle>mvn:org.slf4j/slf4j-api/1.7.12</bundle> 
     <bundle>mvn:my.bundle/utils/${version}</bundle> 

</feature> 

特徵沒有做開始,因爲缺少以下限制:

executing command: Error executing command on bundles: 
    Unable to execute command on bundle 118: Unresolved constraint in bundle utils [118]: Unable to resolve 118.0: missing requirement [118.0] osgi.wiring.package; (osgi.wiri 
ckage=sun.awt) 

的事情是,我不知道這束具有sun.awt。我有沒有找到這個神器的填充,這裏還有其他方面的問題。

任何人有想法?

UPDATE 亞歷山大問如何生成包,這裏是它的Maven POM:

注意:電話我,如果有人想有效POM但這將是巨大的。這就是爲什麼我沒有張貼既不pom.xml中,也沒有有效的pom.xml

<?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/xsd/maven-4.0.0.xsd"> 
    <parent> 
     <groupId>eu.linksmart.gc</groupId> 
     <artifactId>eu.linksmart.gc.osgi.component</artifactId> 
     <version>0.3.0-SNAPSHOT</version> 
    </parent> 
    <modelVersion>4.0.0</modelVersion> 

     <artifactId>utils</artifactId> 
    <version>${linksmart.gc.version}</version> 
    <name>Several Utils</name> 
    <packaging>bundle</packaging> 
    <dependencies> 


     <dependency> 
      <artifactId>org.eclipse.paho.client.mqttv3</artifactId> 
      <groupId>org.eclipse.paho</groupId> 
      <version>1.0.2</version> 
     </dependency> 
     <dependency> 
      <groupId>commons-configuration</groupId> 
      <artifactId>commons-configuration</artifactId> 
      <version>1.10</version> 
     </dependency> 

     <dependency> 
      <groupId>commons-beanutils</groupId> 
      <artifactId>commons-beanutils</artifactId> 
      <version>1.9.2</version> 
     </dependency> 

     <dependency> 
      <groupId>org.apache.commons</groupId> 
      <artifactId>commons-lang3</artifactId> 
      <version>3.1</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
     </dependency> 


    </dependencies> 
    <repositories> 
     <repository> 
      <id>Eclipse Paho Repo</id> 
      <url>https://repo.eclipse.org/content/repositories/paho-releases/</url> 
     </repository> 

     <repository> 
      <id>jboss-maven2-release-repository</id> 
      <url>https://repository.jboss.org/nexus/content/groups/public/</url> 
     </repository> 
     <repository> 
      <id>apache</id> 
      <url>https://linksmart.eu/repo/content/repositories/apache-snapshots/</url> 
     </repository> 
    </repositories> 
    <build> 
    <plugins> 
     <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>build-helper-maven-plugin</artifactId> 
      <executions> 
       <execution> 
        <id>attach-artifacts</id> 
        <phase>package</phase> 
        <goals> 
         <goal>attach-artifact</goal> 
        </goals> 
        <configuration> 
         <artifacts> 
          <artifact> 
           <file>src/main/resources/conf.cfg</file> 
           <type>cfg</type> 
           <classifier>configuration</classifier> 
          </artifact> 
         </artifacts> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
    <plugin> 
     <groupId>org.apache.felix</groupId> 
     <artifactId>maven-bundle-plugin</artifactId> 
     <version>2.4.0</version> 
     <extensions>true</extensions> 
     <configuration> 
      <instructions> 
       <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 

      </instructions> 
     </configuration> 
    </plugin> 
     <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.7</source> 
       <target>1.7</target> 
      </configuration> 
     </plugin> 

    </plugins> 
    </build> 

</project> 
+0

你確實有必要的'sun.awt'類在運行時?你是自己創建utils還是第三方庫?如果你不需要sun.awt,並且這是你自己的代碼,你應該修復utils bundle的導入。 – Ralf

+0

對不起,我沒有看到您的消息。是的,這是我自己的代碼,是的,我不需要sun.awt。但是該軟件包說它需要 –

+2

如果它是你的代碼並且你在控制中,爲什麼不修復'util'包的導入? – Ralf

回答

0

sun.awt從JRE一個包,karaf不會自動使用。你可以修改你的$ KARAF_ETC/jre.properties並在jre中添加一行來指定karaf來提供更多的jre包。

You can find a similar resolution here

+0

我留下了深刻的印象。但沒有奏效。不會顯示在'package:exports'中,並且消息錯誤仍然存​​在 –