jfrog / artifactory-client-java

Artifactory REST Client Java API bindings
Apache License 2.0
319 stars 153 forks source link

Java module system compatibility #292

Open trurli opened 4 years ago

trurli commented 4 years ago

When upgrading an application depending on artifactory-java-client-services (and therefore artifactory-java-client-api) I ran into the following issue:

Java will create something called an "automatic module" for dependencies which do not (yet) conform to Java's module system introduced with Java 9 based on the JAR's name. In this case the automatic modules "artifactory.java.client.services" and "artifactory.java.client.api" are created.

Unfortunately it is not allowed for two modules referenced by "requires" in a module-info to provide the same package (in this case "org.jfrog.artifactory.client", which is both provided in the automatic "api" and "services" module for API and implementation classes respectively). This means that a modularized application can't be built when using this library. It seems that there is no way around this limitation once the application itself is in a module.

This would not pose a problem as long as the application itself is not modularized, but in this case, the application depends on JavaFX which itself was removed from the JDK from 9 upwards. Migrating the application then requires use of OpenJFX which is itself modularized and in turn requires modularizing the application itself, otherwise it is not possible to use FXMLLoader from a class residing in an unnamed module, then in turn leading to the issue with the automatic modules created from "artifactory-java-client-api" and "artifactory-java-client-services".

It might be possible that I overlook something basic here as I am not too familiar with Java's module system yet. Are there any plans on providing a modularized version of the java artifactory library or do you have any hints on how to resolve this dilemma?

argenstijn commented 11 months ago

With java 21 now this should already be fixed long time ago. Unusable this client project for me because of this bug!