OSGi和Maven检测到私有包的使用 [英] OSGi and Maven detect use of private package

查看:75
本文介绍了OSGi和Maven检测到私有包的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开始一个项目,编写OSGi捆绑软件,并使用Maven作为构建管理工具.我的理解是,对于OSGi捆绑包,您可以选择要保留私有/公开的软件包.

I'm starting a project writing OSGi bundle and using Maven as the build management tool. My understanding is for an OSGi bundle you can choose which package you would like to keep private/public.

这是问题:

  • 如果我依赖于将com.example软件包声明为导出软件包并且将com.example.internal声明为私有软件包的捆绑软件,在构建期间是否有任何方法可以检测到com.example.internal的使用(构建应该失败)?
  • If I am depending on a bundle that declares com.example package as exported package and declares com.example.internal as private package, is there any way, during build time, to detect use of com.example.internal (build should fail)?

如果在开发期间可以通过Eclipse检测到,那将是非常棒的,但我对此表示高度怀疑.

It would be awesome if that can be detected during development time by Eclipse, but I highly doubt it can.

推荐答案

一种选择是使用Eclipse的插件开发环境(PDE),这是一种可识别OSGi的工具.它不会让您针对内部软件包进行编译,因此可以为您进行开发时检查.与maven的bundle插件不同,它是清单优先而不是代码优先的,并不是每个人都喜欢的.

One option is to use Eclipse's Plugin Development Environment (PDE), an OSGi-aware set of tools. It won't let you compile against internal packages, so it gives you the development-time checking. Unlike maven's bundle plugin, it's manifest-first rather than code first, which isn't to everyone's taste.

要将PDE与Maven集成,最好的选择是使用Maven Tycho插件.这为您在Maven中提供了一个完全支持OSGi的编译阶段.

To integrate PDE with Maven, the best bet is to use the Maven Tycho plugin. This gives you a fully OSGi-aware compilation stage in Maven.

这篇关于OSGi和Maven检测到私有包的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆