Hi everyone,

In my OSGi-based project, I need to use the XStream open source library http://xstream.codehaus.org/

Unfortunately, there is no OSGi version of the project, so I created an empty Maven project and added XStream as a dependency as follows (pom.xml file is attached):
<dependencies>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>

I then configured BND to embed XStream and its dependencies:
<!-- Packaging -->
<packaging>bundle</packaging>
<!-- Build -->
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>
                            com.thoughtworks.xstream,
                            com.thoughtworks.xstream.io,
                            com.thoughtworks.xstream.io.xml,
</Export-Package>
<Embed-Dependency>
*;groupId=com.thoughtworks.xstream;artifactId=xstream;version=1.4.2,
</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
</plugins>
</build>

When I look in the generated Jar, I find an xstream-1.4.2.jar file as well as the com/toughworks/xstream folder hierarchy with the class files (which seems redundant with the xstream-1.4.2.jar file, but the class in the latest are not the same than the ones under com/toughworks/xstream folder).

My problem is that there is no trace anywhere of the transitive dependencies.
When installing the bundle, I have the following error message in felix:
ERROR: Bundle xstream-osgi [5] Error starting file:/home/ben/Felix-4.0.2/bundle/xstream-osgi-1.4.2.jar (org.osgi.framework.BundleException: Unresolved constraint in bundle xstream-osgi [5]: Unable to resolve 5.0: missing requirement [5.0] osgi.wiring.package; (osgi.wiring.package=com.bea.xml.stream))

What am I doing wrong? Is there a cleaner way to convert to OSGi a library that I do not develop?

Kind regards,

Ben
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
	<modelVersion>4.0.0</modelVersion>

	<!-- =========================================================== -->
	<!-- POM relationships -->
	<!-- =========================================================== -->

	<!-- Maven coordinates -->
	<groupId>com.thoughtworks.xstream</groupId>
	<artifactId>xstream-osgi</artifactId>
	<version>1.4.2</version>

	<!-- Dependencies -->
	<dependencies>
		<dependency>
			<groupId>com.thoughtworks.xstream</groupId>
			<artifactId>xstream</artifactId>
			<version>1.4.2</version>
		</dependency>
	</dependencies>

	<!-- =========================================================== -->
	<!-- Build settings -->
	<!-- =========================================================== -->

	<!-- Packaging -->
	<packaging>bundle</packaging>

	<!-- Build -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.felix</groupId>
				<artifactId>maven-bundle-plugin</artifactId>
				<version>2.3.7</version>
                <extensions>true</extensions>
				<configuration>
					<instructions>
						<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName> 
						<Export-Package>							
							com.thoughtworks.xstream,
							com.thoughtworks.xstream.io,
							com.thoughtworks.xstream.io.xml,
						</Export-Package>
						<Embed-Dependency>
							*;groupId=com.thoughtworks.xstream;artifactId=xstream;version=1.4.2,
						</Embed-Dependency>
						<Embed-Transitive>true</Embed-Transitive>
					</instructions>
				</configuration>
			</plugin>
		</plugins>
	</build>

</project>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
For additional commands, e-mail: users-h...@felix.apache.org

Reply via email to