CommonServiceProvider not found
peterlgh7 opened this issue · 7 comments
I get the following error when I import systems-common in my project:
java.util.ServiceConfigurationError: javax.measure.spi.ServiceProvider: Provider systems.uom.common.spi.CommonServiceProvider not found
My pom.xml:
<dependency>
<groupId>systems.uom</groupId>
<artifactId>systems-common</artifactId>
<version>2.0</version>
</dependency>
Inspecting the systems-common jar, I see a service javax.measure.spi.ServiceProvider
under META-INF/services with the following content:
systems.uom.common.spi.CommonServiceProvider
but the CommonServiceProvider class is not present in the jar.
Digging into the library's pom I found:
<!-- ======================================================= -->
<!-- Packaging (OSGi bundle) -->
<!-- ======================================================= -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<configuration>
<instructions>
<Export-Package>systems.uom.common</Export-Package>
<Private-Package>systems.uom.common.internal</Private-Package>
<Import-Package>*,tech.units.indriya.format</Import-Package>
</instructions>
</configuration>
</plugin>
I know nothing about OSGI, but I saw on the git history that CommonServiceProvider
used to be under systems.uom.common.internal
, so maybe it's just a matter of updating that Private-Package
setting there.
I never had such trouble importing a jar with maven, so I suspect I may be doing something completely wrong here. I apologize in advance if that's the case
The reason it had to be changed is, that the Java Module System (Jigsaw) would not work with a class in an internal package, but I think you're onto something about the missing classes, will add them in the POM, please try 2.0.1-SNAPSHOT
for the time being, they should be in it.
Thanks, 2.0.1-SNAPSHOT
works indeed, I see you added the missing packages in the pom.xml
. I see there is no due date for 2.0.1
, but do you have a raw estimate? I may find some resistance in my team to using a snapshot build.
Thanks for the confirmation, will close that one. Hoping to fix at least #153 (which affects more than just UCUM, right now only system-quantities
contains a module-info
), but then I think 2.0.1 might be out soon.
After having fixed a couple of Jigsaw related issues and found a workaround for the general Surefire problem (using only 2.20 for now as Indriya does, too) as well as upgraded all tests to JUnit 5, I think 2.0.1 is good to release today.
There's just an Indriya release we have to do first.
Thanks for the update, I'll keep an eye on the release
2.0.1 is out on Bintray, it should be available via MavenCentral within a few hours, too.
I had to reopen #153 though, because only when you access UCUM also via JPMS (Jigsaw) the mentioned problem shows up because the UCUM module aimed to improve formatting for its declared units also in other formatters and that violates the package-splitting rule of Jigsaw. Have to remove that and potentially also adjust some JUnit tests, but we would not delay that until a more feature-rich 2.1 update to the systems module, so if you are fine without Jigsaw for UCUM go ahead, all others should work (file a bug if you spot something else) and 2.0.2 should follow within a few days.