This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Bundlor maven plugin warnings - question

We just now started using bundlor (M6) as a plug-in with our maven command line builds (we've been using it in STS for a while). When running the maven build, we see MANY warnings that look like this:

[WARNING] Bundlor Warnings:
[WARNING] The import of package com.company.package does not specify a version.

This is for each package being imported.

My questions:
1. This is not a warning we see in any way inside of STS. Should we?
2. Is this a legit warning - meaning should we be doing something in our template.mf files to make imports explicit with versions all the time?
3. Is there a way to suppress this if we have a legitimate open-ended import?

Ok, impatient as I am, I took a look at the bundlor source code. From what I can tell, there's no way to suppress this warning. The BundlorValidatorFactory throws the VersionedImportsManifestValidator into the validators list and that class unconditionally throws the warning if no version attribute is on an import.

Now, we do version some imports, but not all, and for very large apps this would be ridiculously tedious to match our maven dependency versions to Import-Template versions for specific packages. If we have to do that, we're doing 50% of the work bundlor is doing for us already. (Ok, maybe less than 50%, but its still a PITA.)

So let me re-iterate one of my questions, and hopefully an osgi veteran can help me out here.

Is it a bad practice for us to have imports without versions? Should we strive to versionate ALL our imports into a bundle?

Thanks in advance,
Scott

Comment

You should be able to suppress the warning by adding Import-Template: *;version="0". This is telling Bundlor that you've made a conscious decision that you're happy for all of your imports to match any export version. If you have specific versions for which you'd like to be more restrictive you can still specify those in the Import-Template header - Bundle will only fall back to the * entry if there isn't a better match.

If you know that there's only a single version of a package in your system, or that your code is compatible with all of the versions that will be available then I don't think there's anything wrong with having a zero to infinity version on an import. It may cause problems where there are multiple incompatible versions of a package available but these can easily be fixed as they are encountered by adding an entry to the import template.