Skip to content
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

jar files cannot be loaded using http #643

Open
OLibutzki opened this issue Jul 29, 2021 · 2 comments
Open

jar files cannot be loaded using http #643

OLibutzki opened this issue Jul 29, 2021 · 2 comments

Comments

@OLibutzki
Copy link
Contributor

OLibutzki commented Jul 29, 2021

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.

@codecholeric
Copy link
Collaborator

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 😉 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...

@OLibutzki
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants