Closed ilya-ershov closed 6 years ago
EDIT: I just realized that the ticket is actually about the second issue described in the introduction. I'll leave my original reply here since it's still related.
This is not in any way specific to Vaadin 10, but rather a generic difference between WAR and JAR packaging. On the other hand, previous Vaadin versions used a non-standard convention and then used various internal tricks to still make things work. With Vaadin 10, we are instead relying on the standard way of handling static files, which might cause some surprises for anyone who is used to previous versons.
When you deploy an application as a WAR file, the static resources should be in the root of the WAR file. With the default Maven directory setup, this means that the files should be inside src/main/webapp/
.
When you deploy as a JAR file, the static resources needs to be inside META-INF/resources/
in that JAR file. In the Maven world, this means that the files go to src/main/resources/META-INF/resources/
.
If you take a working application and change the packaging method, you also need to move the resource files accordingly.
Thank you, I beleive I've already tried your solution, and that wasn't working. May be I need to revisit it at spare time because I dont have evidences right now. Edit: can confirm that it works now.
So actually yes, if the issues are not connected to each other, then ticket is about the second one. It is definitely a bug, because it doesn't work on Win, though works on Linux.
Okay I've found that issue is hidden in spring-boot org.springframework.boot.web.servlet.server.StaticResourceJars#getUrls It sees only one pathing jar and nothing more. It doesnt try to locate manifest inside, to locate real dependencies.
Hi @ilya-ershov!
Okay I've found that issue is hidden in spring-boot
If it's a spring-boot issue, do you mind if we close this one? Or was there still something related to Vaadin in this ticket?
I dont mind! You can close it
I beleive I have found 2 ways to reproduce the same issue. At least they seem similar. The first one described here: https://vaadin.com/forum/thread/16988003/17150030 If package vaadin app as fat jar - browser can't load styles/resources (404 error). If package as War - it works as expected. Its great disappointment, but not a blocker for now.
The next one is great blocker. This one is easy reproducible:
plugins { id "com.github.ManifestClasspath" version "0.1.0-RELEASE" }
because on windows it fails with too long classpath errorspringBoot { mainClassName = 'hello.Application' }
gradle bootRun
Expected: styles and other resources are loaded successfully (2xx codes) Actual: 404
Issue is reproducible for Windows. But if use Windows Linux Subsystem - it works as expected. I'm pretty sure that addition manifest classpath plugin breaks expected behaviour on Windows, because on other projects its addition also breaks. Its not the only plugin I tried.
id "ua.eshepelyuk.ManifestClasspath" version "1.0.0"
does the same, so I assume that is not specific for plugin, but rather is vaadin 10 issue.Attached sample project: complete.zip