如何使用Maven Bundle Bundle插件(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

当使用maven捆绑插件的 wrap 命令?命令?

在pom中的配置部分添加以下内容:

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

否则您可能会忽略

的任何软件包
<Export-Package>!*</Export-Package>

使用Maven Bundle插件,我找不到一种实用方法来选择性地排除所选包装依赖项的软件包导出。我的解决方案是将两个 com.springsource.org.postgresql.jdbc4 postgis-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>

最新更新