Alvin
Alvin

Reputation: 10458

OSGi and Maven detect use of private package

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.

Here is the question:

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

Upvotes: 4

Views: 488

Answers (2)

Peter Kriens
Peter Kriens

Reputation: 15372

In think you will find a lot of support for this in bnd(tools). In general, I find these culprits by watching the Import-Package statement, which is nicely visualized in bndtools. There is some support in bnd(tools) to generate warnings/errors when an import package has no import range, which happen when you import a private or non-existent package.

Upvotes: 1

Holly Cummins
Holly Cummins

Reputation: 11492

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.

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.

Upvotes: 4

Related Questions