unitsofmeasurement / uom-lib

Units of Measurement Libraries
Other
14 stars 13 forks source link

Version 2.0.1 of uom-lib-common fails declare its exported packages, making it not usable in an OSGi context #65

Closed glimmerveen closed 3 years ago

glimmerveen commented 3 years ago

Since version 2.0.1 of uom-lib-common the export of the two packages in this library was (I guess unintentionally) removed. This pull request addresses this issue by adding the required instruction to bnd to export the packages.


This change is Reviewable

glimmerveen commented 3 years ago

@keilw : You can add any header to the final MANIFEST.MF as follows:

            <plugin>
                <groupId>biz.aQute.bnd</groupId>
                <artifactId>bnd-maven-plugin</artifactId>
                <configuration>
                    <bnd><![CDATA[
Automatic-Module-Name: tech.uom.lib.common
-exportcontents: tech.uom.lib.common.*
]]></bnd>
                </configuration>
            </plugin>

According to the documentation there are ways bnd can generate the module-info.java for you, but does require a newer version of bnd as the currently used version (4.2.0) does not support these features. Personally I don't have experience with this feature of bnd.

keilw commented 3 years ago

OK will have a look, thanks. We came across problems in the API and Indriya (the RI) after trying to upgrade to Felix 5.1 plugins (that also claim to use bnd under the hood) when the previously working automatic-module-names were destroyed. And since multi-module-JAR functionality is ignored or not properly implemented by some JDK versions (at least up to Java 11 it is broken) that made the fallback lose the module definition. For most of the others module-info works anyway.