Hello,
TLDR: What is the recommended way to deploy a module with dependencies?

I am new to Karaf, and haven't figured out the right way to deploy an
application on Karaf.

Generally an application consists of the application code and dependencies.

For application code, I think there's only one and reasonable way to
deploy, and that is: build the code into bundles and install the bundles
(manually or using karaf-maven-plugin)

For dependencies, there are more than one way to delivery dependencies into
Karaf:

Way 1: pack the dependencies into the application bundle by manually enter
the dependencies' packages into <Private-Package> / <Expport-Package> of
maven-bundle-plugin
    Pros: only one file to install
    Cons: I have to manually manage <Private-Package> / <Export-Package>
which is very error-prone. Also there is a huge risk of missing transitive
dependencies.


Way 2: use <Embed-Dependency>, <Embed-Transitive> to included the
dependencies into the bundle jar.
    Pros: less risky with transitive dependencies. I can control exposure
of the dependencies to other modules.
    Cons: Still have to manually manage which dependencies to included,
decide which one is public, which one is private.

Way 3: create a kar file from the project, then install the kar
    Pros: The process is mostly automatic
    Cons:
        - All the dependencies are public and accessible to all modules
        - I have two files two install for each module: a bundle file and a
kar file.
        - This still cannot handle transitive dependencies of very big
libraries such as Google Firebase SDK, but this is not a problem for the
time being.

Way 4: manually create a feature project to install bundles and features I
need.

Currently, I use:
- "Way 4" to install globally-used dependencies (Apache common libraries,
jdbc, etc).
- "Way 3" to install dependencies of a module that I might want to share
with other modules
- "Way 2" to install private dependencies that I don't want to share with
other modules

I don't know if I am missing anything but this is a lot of work and
error-prone, anyone know a better way to do this? Something more automatic,
less manual, less typing.

Thank you,

Kile

Reply via email to