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?
Using the Maven Bundle Plugin, I couldn't find a practical way of selectively excluding package exports for selected wrapped dependencies. My solution was to instead embed both com.springsource.org.postgresql.jdbc4 and postgis-jdbc in my bundle, and not export their packages:
<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>