Skip to content

Development mode not working due to long classpath. #21051

@wubwubwub

Description

@wubwubwub

Description of the bug

I have seen similar issues being discussed as early as 2018 but hear me out, I have a simple (essentially an empty sample Flow based project, generated by intellij vaadin plugin template (gradle based). And once I add 2 more dependencies, whole dev mode breaks - vital flow dev mode scripts and resources are not present on the page. Again, this is vanilla 'hello world' project. By comparing broken vs working logs, this line stands out:

[ main] c.v.f.s.f.s.FullDependenciesScanner : Visited 2 classes. Took 11 ms.

when things are working it would say Visited 89 classes or so.
After spending 2 more days in debugger, I found out that this break is triggered by path shortening mechanism used by bootRun task in gradle and also if you try and run using intellij with path shortening. The thing is, vaadin relies on spring boot package scanning which at some point calls org.springframework.core.io.support.PathMatchingResourcePatternResolver#getClassPathManifestEntriesFromJar which can't handle absolute path names in jars manifest. This is actually congruent with how JRE itself treats manifest classpath (relative by design). However gradle bootRun and intellij direct 'application' run both have to use absolute paths in classpath jar manifest. I am not sure how spring boot community lives with this bug, but for vaadin on windows, this is complete deal breaker due to humongous amount of dependencies for vaadin dev mode.

Expected behavior

The sample application should load fully. Developer tools and vaadin button should be present in development mode.

Minimal reproducible example

Using intellij (latest version, as described in versions) with vaadin plugin installed, generate Flow based, Gradle based starter project.
open build.gradle and add 1-5 more dependencies (transitive dependencies matter). For me, this single dependency did the trick (add maven { setUrl("https://repo.spring.io/snapshot") } repo)

 implementation("org.springframework.ai:spring-ai-core:1.0.0-SNAPSHOT") 

load the sample page. you will see majority of it is not rendered, vaadin tools button / control is absent.

Versions

  • Vaadin / Flow version: 24.6.5
  • Java version: 21
  • OS version: Windows 10
  • Browser version (if applicable): Chrome 133.0.6943.127
  • Application Server (if applicable): Spring boot 3.2.1
  • IDE (if applicable): Intellij CE 24.3.3

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    🔎 Investigation

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions