![](/img/trans.png)
[英]How to use maven assembly plugin to exclude a package from dependency jar?
[英]How to exclude a named package from a dependency that exists in another dependency using 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>
兩個依賴項導出包:
使用Maven Bundle插件的wrap命令時,如何排除從postgis-jdbc中導出org.postgres ?
將以下內容添加到pom的config部分中:
<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>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.