Open abcfy2 opened 3 years ago
bootRun { sourceResources sourceSets.main }
?
./gradlew bootRun
: .../src/main/resources
./gradlew check
: .../build/resources/main
This is intended behavior. It's required for hot reloading of GSPs/assets/etc.
What is your use case that this is breaking?
Some resources is generated by building projects. E.g, com.gorylenko.gradle-git-properties plugin generate git.properties
after building project.
If I want to get git info, I can inject GitProperties
object:
class MyService {
GitProperties gitProperties
...
}
./grailws war
is working, but ./grailsw run-app
failed, because it cannot find git.properties
in classpath.
And this code is working in Grails 3.x, but breaking in Grails 4.x.
If you want to keep GSP and other resource reloading, you should configure the plugin to add the git.properties
file to src/main/resources/
instead and add that to your .gitignore
.
Otherwise, you can remove the line sourceResources sourceSets.main
from your bootRun configuration, but this will disable reloading from the following directories:
src/main/resources
grails-app/views
grails-app/i18n
grails-app/conf
grails-app/migrations
gradle-git-properties
will generate git.properties
during building, and place to build/resources/main
, which is not in bootRun
classpath. An example: https://guides.grails.org/grails3/adding-commit-info/guide/index.html
But test
task contains this path, and the old grails 3.x also contains build/resources/main
in bootRun
task.
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.
Task List
Steps to Reproduce
Here is a sample
BootStrap.groovy
:./gradlew bootRun
or./grailsw run-app
output:Lost
build/resources/main
in classpath.But
./gradlew check
or./grailsw test-app
output:Contains
build/resources/main
in classpathExpected Behaviour
bootRun
should containbuild/resources/main
classpathActual Behaviour
Since Grails 4.0 lost
build/resources/main
classpath when bootRunEnvironment Information