[英]How to exclude a named package from a dependency that exists in another dependency using Maven Bundle Plugin (BND)?
I have two dependencies: 我有两个依赖项:
<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>
Both dependencies export package: 两个依赖项导出包:
How can I exclude exporting org.postgres from postgis-jdbc when using the Maven Bundle Plugin's wrap command? 使用Maven Bundle插件的wrap命令时,如何排除从postgis-jdbc中导出org.postgres ?
Add the following to your config section in the pom: 将以下内容添加到pom的config部分中:
<Export-Package>!org.postgres</Export-Package>
Or you might ignore any package by 否则您可能会忽略任何软件包
<Export-Package>!*</Export-Package>
Using the Maven Bundle Plugin, I couldn't find a practical way of selectively excluding package exports for selected wrapped dependencies. 使用Maven Bundle插件,我找不到针对选定包装的依赖项有选择地排除软件包导出的实用方法。 My solution was to instead embed both com.springsource.org.postgresql.jdbc4 and postgis-jdbc in my bundle, and not export their packages: 我的解决方案是将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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.