2012-10-22 64 views
1

我有两个依赖:如何使用Maven Bundle Plugin(BND)从另一个依赖项中存在的依赖项中排除命名包?

<dependency> 
    <groupId>org.postgis</groupId> 
    <artifactId>postgis-jdbc</artifactId> 
    <version>1.5.2</version> 
</dependency> 
<dependency> 
    <groupId>org.postgresql</groupId> 
    <artifactId>com.springsource.org.postgresql.jdbc4</artifactId> 
    <version>8.3.604</version> 
</dependency> 

两个出口的依赖关系包:

  • org.postgres

我怎样才能排除了PostGIS-JDBC出口org.postgres使用时Maven Bundle Plugin的换行命令?

回答

0

使用Maven的捆绑插件忽略任何包,我无法找到一个切实可行的办法有选择地排除所选包装依赖项的包出口。我的解决办法,而不是同时嵌入com.springsource.org.postgresql.jdbc4PostGIS的-JDBC在我的包,而不是出口他们的产品:

<plugin> 
    <groupId>org.apache.felix</groupId> 
    <artifactId>maven-bundle-plugin</artifactId> 
    <version>2.3.7</version> 
    <extensions>true</extensions> 
    <configuration> 
     <instructions> 
      ... 
      <Embed-Dependency> 
       postgresql;postgis-jdbc 
      </Embed-Dependency> 
      ... 
     </instructions> 
    </configuration> 
    <executions> 
     <execution> 
      <phase>package</phase> 
      <goals> 
      <goal>bundle</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
1

添加以下的POM你的配置部分:

<Export-Package>!org.postgres</Export-Package> 

或者你可以通过

<Export-Package>!*</Export-Package> 
相关问题