Came across the nice book by
Neil Bartlett on OSGi while reading news on Jigsaw getting delayed and plans to include it in Java 9.
His book is so nice and I finished reading the intro, below are quick facts we should look to design for OSGi
Version Dependency
METAINF.MF could be used to declare the dependencies, but can not enforce version.
1. For example, suppose we determine somehow that a JAR has a dependency on Log4J. Which version of Log4J do we need to supply to make the JAR work?
2. Versions cause other problems. Suppose our application requires two libraries, A and B, and both of these libraries depend in turn upon a third library, C. But they require different versions: library A requires version 1.2 or greater of C, but library B requires version 1.1 of C, and will not work with version 1.2!
Lack of Information Hiding Across JARs
Classes within a JAR need to have access to the classes in other packages of the same JAR. That means we must make those classes public, because that is the only access modifier which makes classes visible across package boundaries. As a consequence, all those classes declared public are accessible to clients outside the JAR as well. Therefore the whole JAR is effectively public API, even the parts that we would prefer to keep hidden.
I hope to continue and complete this book.