-
Notifications
You must be signed in to change notification settings - Fork 306
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
fails with Spring Boot Nested Jars #1224
Comments
We just spoke at OOP, I'll have a look at the reproducer. |
+1 Base image: eclipse-temurin:21.0.2_13-jdk-jammy
|
@odrotbohm did you already have time to look at the reproduction? |
This seems to be caused by this change shipped with Spring Boot 3.2. In contrast to what the commit message suggests, Boot's previous URLs started with @codecholeric – Do you think you could tweak the |
I just debugged this with the Boot team and it looks like the situation is slightly different. |
@odrotbohm so, you basically say we should use
vs
|
Exactly. That's what @philwebb pointed out as, apparently, the assumption is that |
If it's just that I should be able to create a quick fix and release a bugfix version 🙂 Just hope it doesn't break something on some other end, that URL handling is ... not my favorite experience so far 🤪 (also remembering some early troubles before we had a Windows CI environment) |
The ArchUnit build stays green with the suggested fix applied, if that's helpful. 😬 |
This is indeed true! Whilst working on Spring Boot's nested jar support I had to dig quite deeply into the JDK code to really understand what's going on. My understanding is that a typical jar URL looks something like this:
This URL can be thought of as three distinct parts:
Typically the "jar file URL" is a
I didn't dig too deeply into the ArchUnit code, but I'm guessing you're placing the path section of the URL with something else. If you call
I think the you get away with the file version because you have code to handle that scheme. The If you change to using
That keeps the At least that's my understanding of things from the limted amount of time I spend investigating with @odrotbohm. |
For typical plain JAR URLs this doesn't make a real difference, but for special JAR URLs, like Spring Boot uses, it does. The problem showed with nested JAR URLs of Spring Boot. Those have a format like ``` jar:nested:/some/file.jar/!BOOT-INF/lib/nested.jar!/ ``` Here the `connection.getJarFileURL()` is ``` nested:/some/file.jar/!BOOT-INF/lib/nested.jar ``` but the `connection.getURL()` is ``` jar:nested:/some/file.jar/!BOOT-INF/lib/nested.jar!/ ``` Using the latter yields the correct result and allows the custom JAR URL handler to kick in. Using the former will yield an exception that ArchUnit doesn't understand the scheme `nested`. Resolves: #1224
I am using Spring Modulith which internally uses ArchUnit. When starting the application I get the following error:
Can you please support the nested format? I need the information at runtime to get a list of all modules.
Java: Zulu 21
ArchUnit: 1.1.0
Update: Example project: demo.zip
The error only occurs when starting the jar file
The text was updated successfully, but these errors were encountered: