Our project uses the Apache Sling framework, which is built on top of the Felix
container. We have been given a jar file by another team which uses Apache CXF
to connect to a web service. This is a list of the dependencies in that jar:
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-api</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.2.3</version>
</dependency>
<dependency>
<groupId>com.jgoodies</groupId>
<artifactId>forms</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>2.7.2</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1-rev-1</version>
</dependency>
<dependency>
<groupId>com.twmacinta</groupId>
<artifactId>fast-md5</artifactId>
<version>2.7.1</version>
</dependency>
</dependencies>
I set up a module to generate an OSGi bundle from this library. Here is my
configuration:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.5.4</version>
<extensions>true</extensions>
<configuration>
<obrRepository>NONE</obrRepository>
<manifestLocation>META-INF</manifestLocation>
<instructions>
<Export-Package>com.idexx.imaging*</Export-Package>
<Import-Package>
!com.sun*;!junit*;!jgoodies*;!net.sf*;!org.apache.aries*;!org.apache.avalon*;
!org.apache.axiom*;!org.apache.cxf.tools.common*;!org.apache.cxf.tools.validator*;
!org.apache.geronimo*;!org.apache.log*;!org.apache.mina*;!org.junit*;!org.jvnet*;
!org.osgi.service*;!org.relaxng*;!org.springframework*;
*
</Import-Package>
<Embed-Dependency>
!org.apache.felix*;*;scope=compile|runtime
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
<Bundle-ClassPath>{maven-dependencies},.</Bundle-ClassPath>
</instructions>
</configuration>
<executions>
...
</plugin>
My question is about that long list of Import-Package exclusions. When I
initially ran my OSGi bundle in Felix it complained about missing dependencies.
I arrived at this list by iteratively excluding things until I came to a
configuration that worked. Why are there so many things I need to exclude?
Shouldn't these dependencies be picked up by the Embed-Transitive flag? They
can't really all be dynamic dependencies, can they? Could an incorrect POM file
provided by the other team be part of this? Any insight is greatly appreciated.
Thanks!