1

I have a SpringBoot 2.1 project, using Gralde and Angular 7. My ultimate aim to make it very fast to update static files in the 'resources' folder on save.

I've tried the various things to get IntelliJ to automatically update these, and also spring-boot-devtools, but ultimately they all run the "processResources" Gradle task.

My processResources task currently takes 1m 40s as it's coping everything even if only one file has changed. This is on a fast SSD drive. This used to be much faster with older versions of Gradle.

Should processResources copy all files even if only one has changed? Are there any solutions to make this instantaneous?
Maybe I'm missing something fundamental?

NickH
  • 351
  • 5
  • 15
  • 1
    What I wonder is: how comes you have so many resources that it takes 1m40s to copy them, on a SSD. Are you storing gigabytes of images or what? What is in the resources folder? And why do you need to update them so often? I think you're indeed missing something, but we would need more details to know what. – JB Nizet Aug 15 '19 at 12:44
  • @JBNizet Thanks. This is an Angular 2 application that I'm trying to upgrade to current versions. The angular app is in the resources folder, along with node_modules etc. It seems that I need to rethink the whole layout and completely separate the Angular client application from the Java server application. – NickH Aug 15 '19 at 13:04
  • 2
    That's where the problem is indeed. What should be part of the resources in the jar file is the compiled (in production mode) Angular application. Not all its source code and dependencies. That's almost the equivalent of storing your whole gradle dependency cache in the resources folder. Here's an example project with a Spring Boot backend and an Angular frontend built with Gradle: https://github.com/Ninja-Squad/globe42. You just need to start the backend and use ng serve during development. In production, the compiled Angular version is added to the jar to be served by Spring Boot. – JB Nizet Aug 15 '19 at 13:11
  • @NickH If you have some custom tasks you can try marking them as cacheable, it is important to define input and outputs for cachable tasks, see https://stackoverflow.com/questions/50509068/gradle-build-cache-is-not-enabled-for-task – ZqBany Aug 15 '19 at 13:14

0 Answers0