-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PWM provider not found #238
Comments
Hi, did you create a fat jar? I have a similar issue #237 |
Did you include all dependencies for the PiGpio provider? |
Hi, I have included all the dependecies. I tried to start a new Maven project like in your description: https://pi4j.com/documentation/building/fat-jar/ With gradle I was not able to generate a working jar file. I had the same Exception like above, with pigpio-output instead of pigpio-pwm(I use GPIO Output and Input in my code). I looked at these 2 jar Files to find the difference. For the one which is not working:
Could this be the problem? You mentioned (same link in this comment), that the maven-shade-plugin includes the plugins in META-INF/services/com.pi4j.extension.Plugin. and this works |
Hi and thanks for your help Anyway I would like to share my solution. Maybe it's useful for others. When I generated the jar, the line: "com.pi4j.plugin.pigpio.PiGpioPlugin" Probably this line was overwritten because of the other plugin |
@FDelporte With changes in the build.gradle the uberJar has all the code you identified above and I figured out how to add the class path to the manifest in case that was the problem But this is useless as it is an uberJar not individual jars. So I did add a print in the Example code and the classPath is the uberJar. If you run with verbose you can see the code IS looking in the looking in the uberJar Issue #237 mentions hack of removing the Rpi default code and then the pigpio is added. Can you think of any common attributes Pi4j uses to identify these providers in case there is a duplicate value that is then used as a key, so only one provider is added and not both the Rpi and concrete. tasks.register('uberJar', Jar) { |
Found what the bug is, don't understand why dependencies { @FDelporte I don't know if this is a gradle bug/feature the Pi4j stumbles onto or specific to Pi4j. Your thoughts |
shadow.txt pi@raspi464alt: |
I'm a Maven user, so, unfortunately, my Gradle knowledge is very limited... BTW I'm very interested in the Maven output you mentioned about the clean up, can you add it to your comment? |
The issue comes from the fact that different Pi4J maven modules come with different values defined in META- I am using "com.github.johnrengelman.shadow" plugin to build the fat jar. I had to add
in my |
Thanks @toboche for the info! Can you please validate if this Gradle example is correct? It doesn't use that Shadow plugin, but when we created this minimal example, it was working as expected... https://github.com/Pi4J/pi4j-example-minimal/blob/main/build.gradle |
hey @FDelporte , when running
When running
|
Having fixed the issue of missing manifest, I'm getting:
Let me know if you'd like me to open a PR with some fixes for that in the coming weeks :) |
Digging through the web to the main problem of not merged services files by Gradle, This can be added to every Gradle standard "Jar" Task. A Fat-Jar build with Gradle with this task addition runs all Pi4J provider services in parallel: ` tasks.register('dist', Jar) {
|
Hello, after a few days of not touching my project I came to this error which seemingly happened out of nowhere despite it working numerous times before,
com.pi4j.provider.exception.ProviderNotFoundException: Pi4J provider [pigpio-pwm] could not be found. Please include this 'provider' JAR in the classpath.
I have not made any changes to the code that "breaks" my program, and it is actually taken right from the pi4j website:
The text was updated successfully, but these errors were encountered: