The issue happens when I add pathing jar plugin to gradle build of vaadin application to shorten the command line. Thats why I initially thought it is related to vaadin (https://github.com/vaadin/flow/issues/4348). But then I've discovered, that mechanism that is used by vaadin to load static resources is suppported by spring-boot's org.springframework.boot.web.servlet.server.AbstractServletWebServerFactory#getUrlsOfJarsWithMetaInfResources.
The issue is that call to ManagementFactory.getRuntimeMXBean().getClassPath() returns only one pathing-jar, e.g. classpath864792968.zip. It contains manifest inside with all other depenencies.
Expected: pathing jar is used to extract list of resources Actual: only pathing jar itself counts as resource
I've attached gradle project
complete.zip that reproduces the issue. It reproduces it only on Windows because plugin ua.eshepelyuk.ManifestClasspath is smart enough to not turn on pathing for Linux users.
I really appreciate your advice if there is any quick workaround or a fix.
Comment From: philwebb
The source for the Gradle plugin is here. This issue looks quite similar to #5127
Comment From: philwebb
Also this setting might help reproduce the issue without needing Windows.
Comment From: ilya-ershov
Yep, looks similar. Is it still unresolved? I can't run project neither from gradle, nor from IntellliJ because they use both use pathing jar
Comment From: wilkinsona
Yes, it's still unresolved. While #5127 is similar, it was in a completely separate part of the codebase.
Comment From: ilya-ershov
Is there any progress on that bug? I've implemented a workaround that works for me right now. But would be really cool to have official fix. Attaching the workaround if it can help to resolve the bug sooner TomcatStaticResourcesSupportWorkaround.zip
Comment From: wilkinsona
It’s good to know you have a workaround. Thanks.
As shown by the enhancement label, we don’t consider this to be a bug. We will hopefully add support for loading resources in jars found via the Class-Path manifest attribute in 2.1.
Comment From: ilya-ershov
Thanks, hope that thing will get "enhanced" to be usable without dances with a tambourine :)
Comment From: wilkinsona
Snarky, slightly passive aggressive comments aren't a very good motivator. The most effective way for you to increase the chances of this enhancement being made is for you to contribute a pull request.
Comment From: ilya-ershov
Sorry, wasn't trying to offend or add negativeness, thats why I added a smile. However, very thanks for constant delivering spring-boot, and its very inspiring that I can contribute into such an outstanding project.
Comment From: walec51
For Undertow this was required to make vaadin work with bootRun and that jar
@Component
public class StaticResourcesFromManifestClasspathSupport
implements WebServerFactoryCustomizer<UndertowServletWebServerFactory> {
@Override
public void customize(UndertowServletWebServerFactory factory) {
factory.addDeploymentInfoCustomizers(new UndertowDeploymentInfoCustomizer() {
@Override
public void customize(DeploymentInfo deploymentInfo) {
deploymentInfo.setResourceManager(
new ClassPathResourceManager(
deploymentInfo.getClassLoader(),
"META-INF/resources"
)
);
}
});
}
}
Comment From: wilkinsona
Duplicates #9513.