2015-07-20 73 views
-2

我正在使用maven-bundle-plugin并试图将Google地图依赖项捆绑在一起。Google地图类未在导入包中显示MANIFEST.MF

 <plugin> 
      <groupId>org.apache.felix</groupId> 
      <artifactId>maven-bundle-plugin</artifactId> 
      <extensions>true</extensions> 
      <configuration> 
       <instructions> 
        <Bundle-ClassPath>*;scope=compile|runtime</Bundle-ClassPath> 

        <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency> 
        <Embed-Directory>OSGI-INF/lib</Embed-Directory> 
        <Import-Package> 
         * 
        </Import-Package> 
        <_exportcontents> 
           * 
        </_exportcontents> 
       </instructions> 
      </configuration> 
     </plugin> 

当我检查JAR(的Manifest.MF)我可以看到在Export-Packagecom.google.maps.model但不是在Import-Package。我怎样才能在Import-Package中得到它?

这个问题是与先前未解决的问题How to import a class from third party jar file in an OSGi component

回答

0

嘛,不应该有在进口包东西在这里,因为你不导入谷歌地图类,将它们嵌入。您正在将自己的包中的Google jar打包,而Import-Package仅适用于要使用从另一个包导出的类。

至于另一个问题,我不完全确定(我根本不使用Maven捆绑软件插件),但'exportcontents *'似乎是可疑的,导出太多会导致一些细微的问题。

我想说,先不输出任何东西,并根据需要添加包。

0

如果您要将jar包嵌入到您的包中并想要访问其类,请使用Include-Resource指令,它可以选择展开JAR资源(请参阅@选项)