apache / apache/grails-core

Grails 4 multi-project resources' reloading problem - javascript changes are not reloaded!

Open
#11,512 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Groovy
Stars
2.9k
Forks
975
Avg merge
1d 22h
Merged PRs (30d)
92

Description

I have a multi-module project >> a main application with a plugin that the application depends on. I followed the project structure and configuration for the multi-project build mentioned in the Grails [documentation](https://docs.grails.org/snapshot/guide/plugins.html).
**The problem is**: any changes I apply on the javascript files of the plugin are not reloaded and require restarting the application in order to take effect, while it works fine for the changes on the javascript files of the main application.
My javascript files path in both the app and plugin is: src/main/resources/public/js

### Task List

- [ ] Steps to reproduce provided
- [ ] Example that reproduces the problem uploaded to Github
- [ ] Full description of the issue provided (see below)

### Steps to Reproduce

1. Create an empty project directory "Test".
2. Create a new empty Grails4 app (grails create-app myapp) inside the "Test" directory.
3. Create a new empty Grails4 plugin (grails create-plugin myplugin) inside the "Test" directory.
4. In the same directory, create a settings.gradle file with the following content:
`include "myapp", "myplugin"`
5. In build.gradle of the main application (myapp), add the following:
```
grails {
plugins {
compile project(':myplugin')
}
}
```
6. In gradle.properties of the plugin, add exploded=true.
7. In the plugin (myplugin), add "test.js" file to the path src/main/resources/public and add whatever javascript content to it.
8. Run the application using the grailsw run-app or gradlew bootRun commands from the root of the application directory (myapp).
9. Modify the "test.js" file.
10. load the "test.js" file in an explorer (eg. http://localhost:8080/static/test.js), you will see the old content not the new one.

If you repeat the steps 7,8,9,10 on a javascript file in the main app (myapp), the changes are taken directly and you can see it in the browser.

This issue applies to all files in the src/main/resources/public folder.

### Expected Behaviour

The javascript changes in the plugin take effect directly when reloading the page.

### Actual Behaviour

No reloading of the plugin javascript files == the content is not updated == the old files are loaded.

### Environment Information

- **Operating System**: Windows 10
- **Grails Version:** 4.0.0
- **JDK Version:** jdk1.8.0_144
- **Container Version (If Applicable):** n/a

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the multi-project settings.gradle, myapp/build.gradle, myplugin/gradle.properties, and a file under myplugin/src/main/resources/public. Start with grailsw run-app or gradlew bootRun, then request /static/test.js after editing it; done means plugin resource changes are served without restarting the application.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, javascript
Domain
build-system, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.