very cool!

FWIW, I have no object to requiring maven 3 for trunk as long as we can get the build to work more or less as well as it does now. If that helps with osgi-maven tooling I'd say the sooner the better.

thanks
david jencks

On Nov 14, 2009, at 9:05 PM, Jarek Gawor wrote:

Hey,

I added a small plugin that verifies the generated manifest against
the dependencies (bundles). It uses the eclipse API to validate the
manifest so it's following the OSGi rules. Hopefully, this should help
us detect problems sooner at build time. For example, it catches a
problem where the code uses some class from non-exported package. The
complication would be successful but at runtime you would see
resolution problems.

Right now the plugin is only enabled for modules in framework but we
could enable it for all plugins. Also, any problems are reported as
warnings (so it doesn't break the build).

Also, the plugin contains display-manifest goal that displays import
and export packages in the manifest. I just got tired of reading the
manifest file in emacs (yes, i know I could open it in IDE too). To
display the import/export packages run the following (once the code is
compiled and the manifest files are generated):

mvn org.apache.geronimo.buildsupport:geronimo-osgi-plugin:display- manifest

Btw, the plugin borrows a bunch of code from the Tuscany Maven Eclipse
Compiler module. And I might eventually donate this plugin back to
Tuscany.

Side note: The Eclipse JDT compiler supports specifying "access rules"
on each classpath component. With these access rules you can specify
which classes or packages the compiler can see. The Export-Package
header in manifest of the dependencies could be translated into the
right set of access rules. With that in place we could catch the
package visibility issues right at compile time. The
plexus-compiler-eclipse and Tuscany's maven-eclipse-compiler compiler
plugins for maven-compiler-plugin do not support access rules. The
tycho-compiler-jdt compiler plugin has some support for it but they
are not automatically derived from the dependencies - must be passed
explicitly. Tycho's maven-osgi-compiler-plugin has support for access
rules but requires Maven 3.0 and I think it needs Eclipse specific
build files. Anyway, maybe this is something we want to look into in
the future. For now the manifest checking should be good enough.

Jarek

Reply via email to