Dear Developers,

  1. run the spring boot project in dev environment (Netbeans 12.2)
  2. an npm script (build,copyfiles) modifies some files in a maven project folder "\src\main\resources\static\assets" (some js files as well)
  3. in the browser sometimes the file serving is well sometimes I get back 404 error code

Spring Version: 2.7.7 (spring-boot-devtools)

May I ask how can I debug this situation? How can I check the file watching process?

Thanks for any help in advance!

Bela

DevToolError

Comment From: robozb

I tried to use this options without success, the file serving is rhapsodic

DevToolsOptions

Comment From: robozb

The dependency in the POM:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>  

Further deps:

Deps

Deps2

Comment From: wilkinsona

Can you please provide a minimal sample that reproduces the problem?

Comment From: robozb

Ok, I try it!

Comment From: robozb

Until my sample/simple project creation, I made a short video what presents my problem well.

The Spring Boot Dev Tools(?) doesn't reflect the modification by npm copyfiles script but all good if I initiate the modification in the IDE by insert only one space and save :(

https://youtu.be/aS8xNQSn2S4

Comment From: robozb

OK, I guess I figured out what's the problem. The Dev Tools doesn't copy files from /src/main/resources/static/ (or from other folders I guess) to /target/classes/static/ if it happens quickly after the folder deletion.

https://youtu.be/a-P0BflLzig

Comment From: robozb

How can I debug Dev Tools?

Comment From: robozb

A workaround could be to parallel copy the files to src and target folder :(

Comment From: wilkinsona

OK, I guess I figured out what's the problem. The Dev Tools doesn't copy files from /src/main/resources/static/ (or from other folders I guess) to /target/classes/static/ if it happens quickly after the folder deletion.

Dev Tools never performs such copying. It's the job of your IDE or build system to do so. Looking at the video, you're using NetBeans so I suspect that this is a NetBeans bug and it's missing the changes made in src/main/resources and failing to copy them into target/classes.

If you believe the problem is somehow specific to Spring Boot's Dev Tools, please provide a minimal sample that we can use to reproduce it and we can re-open the issue and take another look.

Comment From: robozb

OK, I guess I figured out what's the problem. The Dev Tools doesn't copy files from /src/main/resources/static/ (or from other folders I guess) to /target/classes/static/ if it happens quickly after the folder deletion.

Dev Tools never performs such copying. It's the job of your IDE or build system to do so. Looking at the video, you're using NetBeans so I suspect that this is a NetBeans bug and it's missing the changes made in src/main/resources and failing to copy them into target/classes.

If you believe the problem is somehow specific to Spring Boot's Dev Tools, please provide a minimal sample that we can use to reproduce it and we can re-open the issue and take another look.

Oh, I didn't know! Thank you so much!