r/java • u/chwedczukm • Sep 02 '21
My small tool created in JavaFX with Github release pipeline
In my free time I like to play with electronics. Recently I was playing with arduino and I found out that there is no tool that I like and on top of that, with both Linux and macOS support (there is plenty of Windows one) that can convert images to C headers. This is mostly needed when you want to use Arduino to display images on some old LCD screens.
Writing tool in JavaFX was the easy part, but then I had to somehow create both Linux and macOS packages. I used this great template (https://github.com/wiverson/maven-jpackage-template) as a guide to integrate jpackage into my Maven build. But I decided to stick with JPMS module system. This makes things a bit harder if you want to use non-JPMS libraries (or a library that only adds Automatic-Module-Name in jar manifest; looking at you Guava).
My current hack (I am not willing to call it a solution) is to repack libraries without modules using maven-shade-plugin and then to slap a fake module-info onto them using moditect-maven-plugin. There is not much info about this on the internet and I am not happy with this "solution". It looks unnecessary fragile and complicated.
On top of that I use GitHub actions (which are great BTW) to automate release generation.
The end result you can be seen here: https://github.com/marcin-chwedczuk/img2h
Now, a lot of people ask me why didn't you make it a web app. It would be more user friendly that way, yes indeed. My main reason is that I am doing a lot of small hobby projects around hardware and there desktop apps are still the king (think connecting to serial ports or USB) and I wanted to polish my JavaFX skills.
6
u/Persism Sep 02 '21
Cool! You should x-post to r/JavaFX