Weld OSGi + Apache Felix = cannot find packages

I am using Apache Felix and weld-osgi for a Java SE application. The problem is that in the injected bean I use @ApplicationScopedfrom the package javax.enterprise.context.ApplicationScoped. But weld-osgi-bundle-2.1.2.Finalthere is no such package.

This package exists in weld-se, but it is not included with OSGi. How can I solve this problem?

+4
source share
1 answer

I will try to run the following dependency as a separate package:

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
    <version>1.1-20130918</version>
</dependency>

( Link Maven Central )

, 1.1-20130918. 1.1 OSGi MANIFEST.MF. jar META-INF/MANIFEST.MF OSGi, Bundle-ManifestVersion Bundle-SymbolicName. , Import-Packages.

weld-osgi-bundle Maven Central ( pom.xml). :

<dependency>
    <groupId>org.jboss.weld</groupId>
    <artifactId>weld-api</artifactId>
</dependency>

weld-api cdi-api , :

<dependency>
    <groupId>javax.enterprise</groupId>
    <artifactId>cdi-api</artifactId>
</dependency>

- F3 (Open Declaration) Eclipse, ApplicationScoped, Project Explorer View Link with Editor, , ApplicationScoped.class cdi-api-1.1.jar.

OSGi

, , ( , ). jar OSGi, , :

<dependency>
    <groupId>javax.inject</groupId>
    <artifactId>javax.inject</artifactId>
    <version>1</version>
</dependency>

Maven Central. , javax.inject OSGi:

-, OSGi . , weld-se.jar, .

+4

Source: https://habr.com/ru/post/1535119/


All Articles