Hello João !

First, thanks for your answer.

I see your dependency as "provided", so I suppose that you assume that
classes are exported by some bundle. In my case I didn't find any standard
feature with a bundle that exports the required annotations packages. What
did you do to get them at runtime ?

As I aim to provide custom shell commands, I'd initially prefer to use a
basic OSGi design, and using annotations, and. with the SCR files being
generated by the bundle plugin.

An alternate solution could be using Karaf packages, as described in these
examples (
https://github.com/apache/karaf/blob/main/examples/karaf-command-example/karaf-command-example-command/src/main/java/org/apache/karaf/examples/command/command/AddCommand.java
).

But this also fails : my custom command is not correctly detected and
installed.

An idea of the best way to do that ?

Thanks again.

Regards.

Le jeu. 17 avr. 2025 à 13:47, João Assunção <joao.assun...@exploitsys.com>
a écrit :

> Hi,
> I'm almost sure the annotations are not needed during execution. During
> runtime, SCR uses the XML files included inside the bundle (jar).
> The bundle plugin uses the annotation in the classes to generate those xml
> descriptors.
> In my maven projects, I normally use the "bom" dependency provided by
> karaf to ensure I'm using the same dependencies used by Karaf. For example:
>
>> <dependency>
>>     <groupId>org.apache.karaf</groupId>
>>     <artifactId>karaf-bom</artifactId>
>>     <version>${karaf.version}</version>
>>     <type>pom</type>
>>     <scope>import</scope>
>> </dependency>
>
>
> But for my convenience, I tend to use the Enroute dependency:
> <dependency>
>     <groupId>org.osgi.enroute</groupId>
>     <artifactId>osgi-api</artifactId>
>     <version>7.0.0</version>
>     <type>pom</type>
>     <scope>provided</scope>
>
>> </dependency>
>
>
> Best regards,
> João
>
>
>
>
>
> On Thu, Apr 17, 2025 at 11:50 AM Ephemeris Lappis <
> ephemeris.lap...@gmail.com> wrote:
>
>> Hello.
>>
>> I can't find if a Karaf feature exists to provide the annotations for
>> SCR, such as Service, Reference, etc.
>>
>> Installing the feature "scr" just adds bundles to manage the runtime, not
>> the annotations.
>>
>> Perhaps the packages are provided by  a Compendium bundle.
>>
>> Is there a provided feature that includes them, or do we have to add
>> explicitly bundles for that ? In this case, what is the right version to
>> match the OSGi framework of Karaf 4.4.x ?
>>
>> Thanks for your help.
>>
>> Regards.
>>
>

Reply via email to