mmornati / springboot-osgi-sample

OSGi framework integrated into SpringBoot application
Apache License 2.0
38 stars 18 forks source link

hopefully fixes the bnd build #5

Closed juergen-albert closed 3 years ago

juergen-albert commented 3 years ago

I'm not exzessive maven user and the build wouldn't work for various other reasons at my machine. This should do the tick though.

Signed-off-by: Jürgen Albert j.albert@data-in-motion.biz

mmornati commented 3 years ago

You are the best. 😍 Testing it and fixing the build if needed. 😁

mmornati commented 3 years ago

Oh yeah... it is working. There is only a thing missing in the bnd-maven-plugin: the execution step to link the generation of the file within the standard build phase.

<plugin>
        <groupId>biz.aQute.bnd</groupId>
        <artifactId>bnd-maven-plugin</artifactId>
        <version>${maven.bundle.plugin.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>bnd-process</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

It is working in this way!!

Now I just need to fix the bndrun file... but it should be easy. Many many thanks !

juergen-albert commented 3 years ago

You are welcome! Ping me if you need a hand.

mmornati commented 3 years ago

I'm entering in the same battle with slf4j 😂😂

(&(osgi.wiring.package=org.slf4j)(version>=1.7.0)(!(version>=2.0.0)))

I guess I will configure the bnd file to add the dependency in the bundle... and it should do the trick at the moment. Thanks for your help and for sure I will ask if I will be really blocked. The OSGi first step can be high; there are lot of things to know before you can understand really what you are doing. I spent 3 weeks reading documentation everywhere :) (blog posts from the past 😒)

juergen-albert commented 3 years ago

Not quite sure if you need the bndrun. The bndrun is used to compile the necessary dependencies and start an osgi framework (amongst other things). In your original case, you already have the framework running. So the question is what you want to do.

mmornati commented 3 years ago

Ah so I think I did not understand what is was in the original repository. The only thing I need to do is to define the necessary dependencies and imported jars, like I did in the other sample bundle. https://github.com/mmornati/springboot-osgi-sample/blob/b4d83be40d238fafb565922a5a08a85a240eb60b/sample-bundle/pom.xml#L45 I guess I can do the same with the maven-bnd-plugin? I understood it was done if the bndrun file, but based on what you are asking, I guess it is not true :)

juergen-albert commented 3 years ago

The bnd maven plugin does only one thing: it generates the necessary metadata osgi requires. If you look in the resulting jar, you will find a lot of stuff in the manifest and an XML (which is the result of the @component annotation) in the OSGi inf folder. The necessary depenencies are used taken from your maven deps.

At runtime you have to make sure that all the necessary dependencies are installed in the framework as well.

Marco Mornati notifications@github.com schrieb am So., 24. Jan. 2021, 18:50:

Ah so I think I did not understand what is was in the original repository. The only thing I need to do is to define the necessary dependencies and imported jars, like I did in the other sample bundle. https://github.com/mmornati/springboot-osgi-sample/blob/b4d83be40d238fafb565922a5a08a85a240eb60b/sample-bundle/pom.xml#L45 I guess I can do the same with the maven-bnd-plugin? I understood it was done if the bndrun file, but based on what you are asking, I guess it is not true :)

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mmornati/springboot-osgi-sample/pull/5#issuecomment-766402097, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB6R2QWJWICHVKBQAD73CNTS3RMWBANCNFSM4WQTWDWQ .

mmornati commented 3 years ago

Yeah it was quite easy in the end. It is working in this way in the bnd-maven-plugin

<configuration>
  <bnd><![CDATA[
  -includeresource: slf4j-api-[0-9.]*.jar;logback-*-[0-9.]*.jar;lib:=true
  ]]></bnd>
</configuration>

I will check in the bnd plugin to find all the required configuration for what I did in the other bundle.