Peter Kriens wrote:
I see you create the transitive dependencies for maven but use
import/export package for OSGi. I thought it would be sufficient to
treat bundles as stand alone units? OBR can resolve the package
dependencies in run time from a repository.
I'm vaguely familiar with OBR so I will have to read more about it.
Maintaining the transitive dependencies looks like a horrendous
maintenance job. It means that if a downstream version changes, all the
requirees must be changed.
Yes, that is where most of my time has been spent, but as you point out, I'm probably doing it wrong.
Another issue is optional dependencies. Many libraries are written
that have a lot of optional dependencies. Bnd is a point in case. It
requires Ant when it is used in the Ant context but it when it runs in
Eclipse it should not require ant. These imports should be ignored or
at least be optional. This implies that not all dependencies should be
mandated.

Note that a very important feature of the framework is that "your
installed bundles are your configuration". The set of installed
bundles is something you can play with. You want logging? Installer a
logging bundle, but things should still work without. This flexibility
is very much at odds with the hard transitive dependency model from
maven.
That is what I originally thought but an answer to a previous question on this list [1] led me to believe otherwise. I guess I haven't fully grokked the dependency model of Maven and Felix.

[1] http://www.mail-archive.com/felix-dev@incubator.apache.org/msg02329.html
I do not claim I have all the answers, but personally I would lean to
not make the bundles transitively depend on other bundles, I think
that model is too static for OSGi.

If that is the case, you could use bnd in build mode with only the
specific bundle on the class path. The bnd file can contain the
classpath (-classpath: LIST). Exporting all and importing all then
does the trick, the bnd file can then set all the details like
version, description. If you want to, I can support URLs for the
-classpath which means you could directly load them from the net.
So rather that specifying the library jar in a Maven <dependency> block, use bnd's classpath option? How do I use the classpath option from maven-bundle-plugin?
I have written a small deploy tool for an ftp server, it would be easy
to add an file server so you could deploy them to the maven repo
without the support from maven. The conversion would then only consist
of a bunch of bnd files, you could then daily do:

   bnd build *.bnd
   deploy -r file:~/.m2/repository *.jar

The deploy automatically makes the POM file from the manifest
information.

Anyway, most important decision is how to handle the transitive
dependencies. Very curious about your, Richard's and other opinions.
This is a pretty import decision.
I agree that it is an important topic. However, I'm still learning Felix, Maven, etc. so my opinion might not mean much. ;)
Kind regards,

     Peter kriens
Thanks for your insight.
TMJ> [
TMJ> 
http://issues.apache.org/jira/browse/FELIX-171?page=comments#action_12448473 ]
TMJ> TMJ> Tim Moloney commented on FELIX-171:
TMJ> -----------------------------------

TMJ> 1. Use bnd to analyze the library jar (e.g., java -jar
TMJ> bnd-0.0.jar print path/to/FOO.jar)
TMJ> 2. At the bottom of the bnd output, look for "Unresolved
TMJ> references to ..." which identify package dependencies.  If found,
TMJ>   a. Identifiy the library jars that provide the missing packages
TMJ>   b. Recursively use this process on each dependency
TMJ> 3. Create a directory that will be the project directory for the bundle 
(e.g., mkdir FOO-osgi)
TMJ> 4. Copy the template pom.xml file to the bundle's project directory
TMJ> 5. Edit the pom.xml file to tailor it for the library jar.  Specifically,
TMJ>   a. change artifactId
TMJ>   b. verify description
TMJ>   c. change version
TMJ>   d. change FOO's library jar dependency (groupId, artifactId)
TMJ>   e. add any other dependencies (from step 2b)
TMJ>   f. change Export-Package
TMJ>   g. change Private-Package or delete it if it's not needed
TMJ> 6. Run "mvn package" to in the project directory to create the bundle
TMJ> 7. Use bnd to verify the bundle's contents (e.g., java -jar
TMJ> bnd-0.0.jar print target/FOO-osgi-VERSION.jar)
TMJ> 8. Run "mvn install" to install the bundle in the local repository

Document process of creating bundles using bnd
----------------------------------------------

                Key: FELIX-171
                URL: http://issues.apache.org/jira/browse/FELIX-171
            Project: Felix
         Issue Type: Improvement
         Components: Felix Commons
        Environment: OSGi application development
           Reporter: Tim Moloney
           Priority: Trivial

Provide the list of steps required to create a library bundle by wrapping the 
library jar using bnd (http://www.aqute.biz/Code/Bnd).

Reply via email to