I have a very simple OSGI app that just listens on register/unregister and sends some message to stdout.
What I have in my app is a simple Spring initialized bean. I use the maven bundle plugin to bundle the jar and put it into felix. This is an exceprt of the pom:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.1.0.RELEASE</version>
<type>jar</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.2.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>org.spring.*</Export-Package>
<Bundle-Activator>foo.bar.Activator</Bundle-Activator>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
The project compiles just fine and can be deployed into Felix just fine, however, when the activator is called, it complains about missing dependency like that:
Unresolved constraint in bundle foo.bar.project [56]: Unable to resolve 56.0: missing requirement [56.0] osgi.wiring.package; (&(osgi.wiring.package=org.springframework.context)(version>=3.1.0)(!(version>=4.0.0)))
I tried changing this line:
org.spring.*
To this:
*
In which felix complains that android-dalvik is not present, so I am completely clueless.
Any idea how to include Spring in an OSGI project without using Spring DM?
EDIT: Here is what the generated manifest complains about (from web console)
Exported Packages
foo.bar.osgi foo.bar.service foobar.tracker
Imported Packages org.osgi.framework,version=[1.6,2) from org.apache.felix.framework (0) org.osgi.util.tracker,version=[1.5,2) from org.apache.felix.framework (0) ERROR: org.springframework.context,version=[3.1,4) -- Cannot be resolved ERROR: org.springframework.context.support,version=[3.1,4) -- Cannot be resolved
Manifest Headers Bnd-LastModified: 1339014840268
Build-Jdk: 1.6.0_32
Built-By: fooBar
Bundle-Activator: foo.bar.osgi.Activator
Bundle-ManifestVersion: 2
Bundle-Name: fooBar
Bundle-SymbolicName: foo.bar.OSGIProject
Bundle-Version: 0.20.0.SNAPSHOT
Created-By: Apache Maven Bundle Plugin
Export-Package: foo.bar.osgi.tracker; uses:="foo.bar.osgi.service, org.osgi.util.tracker, org.osgi.framework",
foo.bar.osgi; uses:="org.springframework.context.support, org.springframework.context, org.osgi.framework", foo.bar.osgi.service
Import-Package:
org.osgi.framework; version="[1.6, 2)", org.osgi.util.tracker; version="[1.5, 2)", org.springframework.context; version="[3.1, 4)", org.springframework.context.support; version="[3.1, 4)" Manifest-Version: 1.0 Tool: Bnd-1.15.0
This is when I changed in pom
<configuration>
<instructions>
<Include-Resource>src/main/resources/spring-beans.xml</Include-Resource>
<Bundle-Activator>nl.synovite.scheduled.osgi.Activator</Bundle-Activator>
<Import-Package>*</Import-Package>></instructions>
</configuration>