-
- Notifications
You must be signed in to change notification settings - Fork 967
Add 'migrations' to grailsAppResourceDirs resolve duplicates #15084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The 'migrations' directory is now included in grailsAppResourceDirs, allowing it to be treated as a resource directory alongside 'views', 'i18n', and 'conf'.
| This fixed bootRun, bootJar and bootWar, but causes a duplication issue with dbm-update |
|
| dbm-update has never worked for me in the past. It doesn't load the same context that bootRun does. I'd argue dbm-update should be replaceed by something that just starts the server & shuts down. |
which historically was added to build.gradle, but was not auto generated by forge, to accomplish adding /grails-app/migrations/* to /build/resources/main or the generated war/jar, also creates the duplicates issue, so I am moving forward with fixing that also as part of this PR too |
Changed DatabaseMigrationCommand to use only ClassLoaderResourceAccessor, removing FileSystemResourceAccessor for changelog location. Updated upgrade guide to note that adding 'grails-app/migrations' to the main sourceSet is no longer necessary, as it is now handled automatically by the Gradle plugin.
Deleted instructions about configuring the migrations folder in Gradle, as this step is no longer necessary or relevant for Grails 4 and above.
| Resolved duplicates issue and updated docs |
Added clarification that manual sourceSet configuration for 'grails-app/migrations' is no longer needed and provided guidance to remove related code from 'build.gradle'.
jdaugherty left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks there are some code style issues and maybe test failures?
Deleted unused imports for CompositeResourceAccessor and FileSystemResourceAccessor from DatabaseMigrationCommand.groovy to clean up the code.
Updated createResourceAccessor to use CompositeResourceAccessor with either ClassLoaderResourceAccessor or FileSystemResourceAccessor based on the presence of the changelog file in the classpath. This avoids duplicate migrations when files are present in both the classpath and filesystem.
The 'migrations' directory is now included in grailsAppResourceDirs, allowing it to be treated as a resource directory alongside 'views', 'i18n', and 'conf'.
resolves: #15078
The underlying issue, which also appears to be true for Grails 6, is that /grails-app/migrations/* are not added to /build/resources/main or the generated war/jar
Due to: #15077, the following is required to test on Windows