Hello Pedro,

To help you I’d first like to understand your current approach a bit better. 
You say you download these non-bundle dependencies and put them in the “bundle” 
directory until you get no more dependency errors. What effect does that have? 
Since they are not bundles, how does adding them to a directory help?

As Christian points out, the problem is really with these libraries. Remember 
that Maven is also famous for downloading when you ask for the slightest thing. 
The reason for this is poor internal coherency which results in _fan out_. To 
explain:

1. You depend on package org.foo which is part of the JAR file foolib.
2. foolib contains 20 other packages *that you are not using*
3. those 20 useless packages depend on five more JARs
4. GOTO 1.

Turning these JARs into bundles doesn’t help because they still have all those 
dependencies which all have to be resolved in order for OSGi to be happy.

A better solution is to pull in only the packages that you really need. For 
example if you use the Conditional-Package instruction in bnd (also available 
as Conditional_Package in the maven-bundle-plugin) then you can create a bundle 
that includes only the packages that are referenced by your core code. This 
doesn’t always help because sometimes people have poor coherency even within 
their packages — general util packages are a common problem, just look at the 
dependencies from java.util for example — but it still easier to deal with than 
big messy JAR files.

I hope that helps.

Regards,
Neil 


From: PedroD <[email protected]>
Reply: [email protected] <[email protected]>>
Date: 24 October 2014 at 15:03:41
To: [email protected] <[email protected]>>
Subject:  managing OSGi Dependencies  

Greetings,  

I’m using Felix Framework for my OSGi project, but I’ve came across a severe 
problem concerning third party dependencies.  

I’m using eclipse and maven-bundle-plugin to generate my bundles from the 
sources and the MANIFEST.MF from the POM.XML file. So far so good. however when 
I have some third party dependency in my bundle, I find myself looking for an 
infinite list of JARs, which usually are not bundles, and putting them in my 
/bundle Felix directory until no more dependencies are missing.  

I call this process “Downloading the Internet for my OSGi application to work”. 
 

What am I doing wrong? Sure I must be doing something very wrong, because I 
can’t imagine anyone having a bundle A that depends on B, which then depends on 
C and D, and then those two will depend on several others and so on…  

What is the correct way to automate this? I would love to have one of the two 
solutions:  

1) Be able to create a massive JAR file with all of its dependencies embedded, 
but exporting only the packages I want, and, of corse, not importing any 
package.  

2) (My preferred solution) Having a way to get all my dependencies into 
individual JAR files that I can simply paste into the /bundle directory.  

I have found tools that do me this, but they only do it for direct (1st degree) 
dependencies, leaving transitive dependencies for me to solve manually.  

This problem is critical. The lack of such a tool hampers the usage of OSGi. 
I’ve searched and searched and searched, I’ve came across all the 101 solutions 
such as PAX, bndtools, and friends, but they do not solve this issue…  

Please help me.  

Thanks!  
---------------------------------------------------------------------  
To unsubscribe, e-mail: [email protected]  
For additional commands, e-mail: [email protected]  

Reply via email to