ctongfei / progressbar

Terminal-based progress bar for Java / JVM
http://tongfei.me/progressbar/
MIT License
1.07k stars 102 forks source link

Impossible to use in a fully modular application with finely grained jline libraries. #158

Closed brett-smith closed 8 months ago

brett-smith commented 8 months ago

The recent addition of module-info.java, while welcome has made it impossible to use correctly in a fully modular application with JLine's finely grained jars.

For example, I am currently using jline-terminal, jline-console, jline-reader and jline-style. This means I have something like this in my apps module-info,

requires transitive org.jline.terminal;
requires transitive org.jline.reader;
requires transitive org.jline.console;
requires org.jline.style;

I now wish to add progressbar to this, but cannot be it itself has requires org.jline which is only available in the bundled jline.

The 2 workarounds I have found so far are ..

I understand this is not really the fault of progressbar. It is just the way things are because of how JPMS works, and the fact that JLine even offers this choice.

However, I believe progressbar should change to accommodate this. I think it would make more sense if progressbar itself expects you to be using the finely grained JLine modules by default, and if you want to use the bundle, you have to do so yourself and may only do so in a non-modular application.

The other alternative is for progressbar to provided two differrent versions of the artifact. One that depends on (and has a module-info for) the JLine bundle, and another that depends on (and has module-info requires for) all the used finely grained modules. Other projects such as JNA do this.

ctongfei commented 8 months ago

Thanks @brett-smith ! I guess to fix this, I just need to change

requires org.jline;

to

requires org.jline.terminal;

? Of course, the maven dependencies also have to be changed.

ctongfei commented 8 months ago

Fixed by #159.

brett-smith commented 8 months ago

Oh, thanks for the quick merge, much appreciated.