问题描述
使用Maven开发OSGi应用程序时,主要有两种方法:POM优先和MANIFEST优先.
There are two main approaches when developing an OSGi application with Maven: POM-first and MANIFEST first.
我正在寻找一种表格形式的答案,以显示每种方法的优缺点.
I'm looking for an answer that is in a form of a table that shows pros and cons of each method.
更具体地说,我还想知道它与以下内容之间的关系:
To be more specific, I would also like to know how it relates to:
- 工具集的成熟度
- 供应商独立性
- 易于开发(包括找到可以使用该工具进行开发的人员)
- 兼容性
- 避免ClassNotFound
- 避免体力劳动
推荐答案
目前这是我能想到的
POM-First Pro(使用maven-bundle-plugin)
- 利用现有的Maven技能,存储库和工具.
- 很容易找到知道如何管理pom.xml的人,而不是将MANIFEST.MF与pom.xml一起管理
- MANIFEST.MF中的大多数信息都可以从pom.xml本身获得.
- 不仅可以使用基于Eclipse的IDE,还可以与其他IDE一起使用.
- 侵入性较小,只需添加单个插件并将包装类型更改为捆绑"
- Leverages existing Maven skills, repositories and tooling.
- Likely easier to find people who know how to manage pom.xml rather than MANIFEST.MF along with pom.xml
- Most of the information in MANIFEST.MF can be obtained from the pom.xml itself.
- Can work with other IDEs not just Eclipse based ones.
- Less invasive, just add the single plugin and change the packaging type to "bundle"
POM优先考虑
-
ClassNotFoundException
更可能在运行时发生.但是,可以使用pax考试来缓解这种情况(尽管设置起来非常复杂). - 仍然需要了解如何设置清单以确保正确设置
instructions
配置元素.
ClassNotFoundException
more likely to occur at runtime. However, this can be mitigated using pax-exam (although it is very complicated to set up).- Still need to understand how the MANIFEST is setup to make sure the
instructions
configuration element is set correctly.
清单优先的专业人士(使用tycho-maven-plugin)
- 似乎是推荐的方法,或者至少是被推荐的方法,但是我真的看不出为什么它有很大的好处. (因此为什么会问这个问题).
- 非常适合开发Eclipse插件,并且可以与PDE很好地集成
- 提供用于测试的工具,从而允许
ClassNotFoundException
在JUnit测试期间而不是在运行时出现.
- Seems to be the recommended approach, or at least talked about as the recommended approach, but I can't really see why it has significant benefit. (Hence why this question was asked).
- Good for developing Eclipse plugins and integrates well with PDE
- Provides tooling for testing thus allowing
ClassNotFoundException
to appear during JUnit testing rather than runtime.
清单优先的缺点
- 似乎只能在基于Eclipse的IDE上很好地工作.您不必使用Eclipse,但是如果没有PDE,您会想要吗?
- 违反DRY原则,因为我必须保持POM和MANIFEST.MF中的名称和版本保持同步.
- 需要以特定的方式命名事物
- 您不能混合使用,这意味着现有的Maven多项目安装不能仅仅依靠OSGi支持
- 与maven-bundle-plugin相比,需要进行更多配置才能减少警告: http: //wiki.eclipse.org/Tycho/Reference_Card#Examplary_parent_POM
- 必须使测试用例成为一个单独的项目.内置src/test/java后,它将无法运行.
- 似乎它只会测试公开的类,换句话说就是".internal"中的类.无法测试.
- Seems to only work well on Eclipse based IDEs. You don't have to use Eclipse, but without the PDE would you want to?
- Violates DRY principles since I have to do put keep the names and versions from the POM and MANIFEST.MF in sync.
- Need to name things in a specific fashion
- You cannot mix, meaning existing Maven multi-project installations cannot just tack on OSGi support
- A lot more configuration compared to maven-bundle-plugin is needed to get less warnings: http://wiki.eclipse.org/Tycho/Reference_Card#Examplary_parent_POM
- Have to make test cases a separate project. It won't run when built in src/test/java.
- Seems that it will only test classes that are exposed, in other words those in ".internal." is not testable.
如果有人要求我为已经在使用Maven并想要迁移到OSGi的企业提供建议,那么将是 POM首先
If I were asked for a recommendation for an enterprise that is using Maven already and want to move to OSGi then it would be POM first
如果有人要求我为正在进行Eclipse插件开发的人提供建议,那么它是首先实现-与tycho
If I were asked for a recommendation for someone who is doing Eclipse plugin development, then it is Manifest first -- with tycho
这篇关于用Maven开发OSGi应用程序时应该首先使用POM还是首先使用MANIFEST?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!