Repository navigation
fix: keep plugin templates out of the processResources filters - #16086
Merged
Merged
Conversation
Routing src/main/templates through processResources subjected it to the
`**/*.gsp` exclusion that keeps compiled views out of build/resources/main,
because copy patterns set on a task apply to every spec composed into it.
Plugin templates are frequently GSPs, so this silently emptied them: the
grails-scaffolding jar lost all four META-INF/templates/scaffolding/*.gsp that
generate-views renders from, and grails-spring-security-ui lost all 45
META-INF/templates/views/**/*.gsp behind s2ui-override. Both shipped bare
directory entries instead.
copyCommands and copyTemplates now each own one directory that nothing else
writes, laid out as the archive sees it, attached to a source set output rather
than copied again by process*Resources. They stay Copy tasks, so build scripts
keep using tasks.named('copyTemplates', Copy), and they are registered when the
plugin is applied instead of in afterEvaluate - only the companion routing has
to defer, since grails-plugin-cli is applied after this plugin.
A plain Copy only ever adds, and a private staging directory gets no stale-state
cleanup from Gradle - not even when registered through SourceSetOutput.dir. Each
task therefore clears its own destination in a task action, so a deleted script
or template stops being packaged. Being an action rather than a separate clean
task, it runs only when the task executes and leaves up-to-date checks intact.
Sync would give the same result but would change a task type build scripts
depend on.
src/main/templates was also being contributed twice, once by enableNative2Ascii
and once by copyTemplates, an overlap that DuplicatesStrategy.INCLUDE was
hiding. That wiring moves out of enableNative2Ascii, which it never belonged to,
into an overridable configureTemplateResources that Grails plugins turn off
because copyTemplates already packages them.
PluginScriptCommandPackagingSpec covers companion and non-companion packaging,
GSP templates surviving alongside excluded plugin views, neither copy task
writing into a process*Resources output, and deletions taking effect without a
clean.
Contributor
|
Reviewed and merged into #16082 (fast-forward to This is the right fix for GSP templates being dropped by the processResources |
jamesfredley
merged commit Aug 2, 2026
82ebbd7
into
fix/move-plugin-scripts-to-cli-companion
48 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #16082