ArchUnit
ArchUnit copied to clipboard
jar files cannot be loaded using http
I would like to import the classes using a http url which references a jar file:
final JavaClasses javaClasses = new ClassFileImporter().importUrl(
new URL("jar:https://repo1.maven.org/maven2/org/jmolecules/integrations/jmolecules-spring-data-jpa/0.3.0/jmolecules-spring-data-jpa-0.3.0.jar!/")
);
Unfortunately the com.tngtech.archunit.core.importer.NormalizedUri replaces :// with :/. Because of this replacement the url changes to https:/repo1.maven.org/maven2/org/jmolecules/integrations/jmolecules-spring-data-jpa/0.3.0/jmolecules-spring-data-jpa-0.3.0.jar!/ and the file cannot be downloaded anymore.
Yes, back then I decided to only import local file URIs, because I didn't think anybody would have the use case to import http URIs :wink: Also because I thought that most times users would want to import classes multiple times and then having it locally would make sense anyway. Would you like to create a PR for it? I can unfortunately not promise anything how fast I can get to the issue myself...
To be honest, the issue is not high prioritized as there is a reasonable workaround of adding the library as runtime dependency and excluding all its transitive dependencies.
That does the trick and I benefit from maven's local repository caching.
Nevertheless, it's a bug (or missing feature) and therefore it's worth to have this issue.