I would try running the following dependency as separate bundle:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.1-20130918</version>
</dependency>
(Maven Central link)
Be careful, you need version 1.1-20130918
. Version 1.1 does not have OSGi headers in the MANIFEST.MF
. You can unzip the jar
and check the META-INF/MANIFEST.MF
file for OSGi headers like Bundle-ManifestVersion
and Bundle-SymbolicName
. You can also check here the required packages of that bundle, it's in the Import-Packages
header.
How to figure out
Check the dependencies of weld-osgi-bundle
on Maven Central (or in its pom.xml
). It contains the following:
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-api</artifactId>
</dependency>
This weld-api refers to the cdi-api
above which contains the missing annotation:
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
</dependency>
Another way is pressing F3 (Open Declaration) in Eclipse while the cursor in the ApplicationScoped
annotation then in the Project Explorer View enable the Link with Editor and it will show that ApplicationScoped.class
is inside the cdi-api-1.1.jar
.
Finding OSGi version of another jars
You probably need more bundles than this one (transitive dependencies or it was only the first one which stopped the installation).
Not all well-known jar
has OSGi headers, like the following one:
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
In that case search for the group id on Maven Central. Two results which contain the javax.inject
package and have OSGi headers:
If you can't find anything you can convert any jar to OSGi bundle by hand. Actually, you can do this with the weld-se.jar
but installing dependencies separately looks cleaner.