I'm using OSGi for my latest project at work, and it's pretty beautiful as far as modularity and functionality.
But I'm not happy with the development workflow. Eventually, I plan to have 30-50 separate bundles, arranged in a dependency graph - supposedly, this is what OSGi is designed for. But I can't figure out a clean way to manage dependencies at compile time.
Example: You have bundles A and B. B depends on packages defined in A. Each bundle is developed as a separate Java project.
In order to compile B, A has to be on the javac classpath.
Do you:
- Reference the file system location of project A in B's build script?
- Build A and throw the jar into B's lib directory?
- Rely on Eclipse's "referenced projects" feature and always use Eclipse's classpath to build (ugh)
- Use a common "lib" directory for all projects and dump the bundle jars there after compilation?
- Set up a bundle repository, parse the manifest from the build script and pull down the required bundles from the repository?
No. 5 sounds the cleanest, but also like a lot of overhead.