OSGi与Maven
Maven也具有模块化系统的特征;但是它只是一个编译时工具,而不是运行时框架。Maven并不是OSGi的竞争者,而是OSGi的一个补充。
通过在pom.xml中指定所依赖jar包的名称、版本号,Maven就能在编译时自动下载正确的jar文件,并部署到classpath中。
然而Maven并没有解决JAR文件的缺点:
- 同样使用全局的classpath;
- 同样不能做到包级别的信息隐藏;
而且pom.xml的格式与OSGi格式并不兼容。所以,如果用Maven编译OSGi系统,通常需要定义两遍metadata:
- 在pom.xml中定义Maven的metadata
- 在MANIFEST.MF中定义OSGi的metadata
----------
Maven and Ivy are both popular tools that have some characteristics of a module system, but they are build-time tools rather than runtime frameworks. Thus they do not compete directly with OSGi, in fact they are complementary and many developers are using Maven or Ivy to build OSGi-based systems.
Maven is a complete, standalone build tool, whereas Ivy is a component th