Spring-Boot-Devtools doesn't want to reload process (doesn't pick up proper classpaths?)
Asked Answered
T

2

7

I have a small Spring Boot project (from spring-boot-starter). Everything configured, i want to use Spring-Boot-Devtools for automatic reloading. When i launch my project (mvn spring-boot:run -X) from my git repo working dir, i can see:

maven logs:

DEBUG] Classpath for forked process: C:\Users\razor\git\spring-boot-starter\target\classes;........

that's ok, path looks good. and then app logs:

2016-09-21 23:47:59.568 DEBUG 13528 --- [ restartedMain] .b.l.ClasspathLoggingApplicationListener : Application started with classpath: []

classpath empty? probably that's the problem that Devtools doesn't want to automatically reload my app. But why ?

When i copy project folder (no other alterations !!!) to other place, reloading works !

Maven (mvn spring-boot:run -X) :

[DEBUG] Classpath for forked process: C:\Java\workspace_rentit\spring-boot-starter2\target\classes;.....

and later:

2016-09-21 23:40:34.224 DEBUG 4060 --- [ restartedMain] .b.l.ClasspathLoggingApplicationListener : Application started with classpath [file:/C:/Java/workspace_rentit/spring-boot-starter2/target/classes/]

Why are there differences? What's wrong ? in second case, reloading works.

Tootsie answered 22/9, 2016 at 8:52 Comment(0)
T
3

Ok, after fiddling with a project for a few more minutes, i've found that probably the problem is the project folder name 'spring-boot-starter' (default project name from eclipse spring boot creator?) that's why reloading in different folder worked (project folder name was different too), after changing project folder name under my git repo, reloading started to work again.

Is it documented 'feature' ? :)

looks like project's DIRECTORY shouldn't be named 'spring-boot-....' (it's not connected with artifact name or eclipse project name)

Tootsie answered 22/9, 2016 at 10:31 Comment(0)
H
5

Spring Boot ignores certain project names when considering whether or not an automatic restart should occur. This is described in the documentation:

When deciding if an entry on the classpath should trigger a restart when it changes, DevTools automatically ignores projects named spring-boot, spring-boot-devtools, spring-boot-autoconfigure, spring-boot-actuator, and spring-boot-starter

You should rename your project so that it's clear that it's not a part of Spring Boot itself and is eligible for automatic restarts.

Heartbreaker answered 22/9, 2016 at 10:49 Comment(1)
that wasn't clear. my artifact was not a 'spring-boot- ....', my project in eclipse is still 'spring-boot-starter' but the only thing i had to change is a project's FOLDER name - it shouldn't be 'spring-boot-....' i guess ?Tootsie
T
3

Ok, after fiddling with a project for a few more minutes, i've found that probably the problem is the project folder name 'spring-boot-starter' (default project name from eclipse spring boot creator?) that's why reloading in different folder worked (project folder name was different too), after changing project folder name under my git repo, reloading started to work again.

Is it documented 'feature' ? :)

looks like project's DIRECTORY shouldn't be named 'spring-boot-....' (it's not connected with artifact name or eclipse project name)

Tootsie answered 22/9, 2016 at 10:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.