@groovy.transform.CompileStatic class GrailsPluginGradlePlugin extends GrailsGradlePlugin
A Gradle plugin for Grails plugins
| Modifiers | Name | Description |
|---|---|---|
protected static java.lang.String |
COMMANDS_STAGING_DIR |
Build-dir root staged by copyCommands; laid out as the archive sees it. |
static java.lang.String |
PLUGIN_ID |
|
protected static java.lang.String |
TEMPLATES_STAGING_DIR |
Build-dir root staged by copyTemplates; laid out as the archive sees it. |
| Properties inherited from class | Properties |
|---|---|
class GrailsGradlePlugin |
basePluginClasses, excludedGrailsAppSourceDirs, grailsAppResourceDirs |
| Constructor and description |
|---|
GrailsPluginGradlePlugin(ToolingModelBuilderRegistry registry) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
apply(Project project) |
|
protected void |
applySpringBootPlugin(Project project) |
|
protected void |
checkForConfigurationClash(Project project) |
|
protected void |
configureAssembleTask(Project project) |
|
protected void |
configureAstSources(Project project) |
|
protected void |
configureJarTask(Project project) |
|
protected void |
configurePluginResources(Project project)Packages plugin templates into the runtime jar and routes command scripts into either the runtime jar or the companion -cli jar. |
|
protected void |
configureSourcesJarTask(Project project) |
|
protected void |
configureTemplateResources(Project project)A plugin's src/main/templates are always packaged by copyTemplates, so the
base wiring that folds them into processResources must not also apply. |
|
protected void |
createBuildPropertiesTask(Project project) |
|
protected java.lang.String |
getDefaultProfile() |
|
protected groovy.lang.Closure<java.lang.String> |
getGroovyCompilerScript(GroovyCompile compile, Project project) |
Build-dir root staged by copyCommands; laid out as the archive sees it.
Build-dir root staged by copyTemplates; laid out as the archive sees it.
Packages plugin templates into the runtime jar and routes command scripts into either the
runtime jar or the companion -cli jar.
When GrailsCliArtifactGradlePlugin is applied, src/main/scripts is staged
as META-INF/commands on the cli source set, so Groovy/YAML/JSON command resources
ship only on grailsCliClasspath and stay out of runtimeClasspath,
bootJar, and bootWar. Without a companion, the historical behavior is
preserved: scripts remain in the runtime plugin jar so unmigrated Grails 7 plugins and
legacyCommandSupport consumers keep discovering them on the application classpath.
Templates always stay on the runtime jar.
copyCommands and copyTemplates stay Copy tasks - build scripts
configure them through tasks.named('copyTemplates', Copy) - and each owns one
directory that nothing else writes, laid out exactly as the archive sees it. The staging
tree is wiped before it is regenerated, so a script or template whose source was deleted
stops being packaged; a plain Copy only ever adds. The wipe runs as a task action,
so it happens only when the task actually executes and up-to-date checks are untouched.
Those directories are attached to a source set output instead of being copied again by
process*Resources. That is what keeps GSP templates intact: grails-app/views
is a resource directory whose *.gsp files are excluded from processResources,
and copy patterns set on a task apply to every spec composed into it - so anything routed
through processResources would lose the GSP templates that generate-views and
s2ui-override render from.
A plugin's src/main/templates are always packaged by copyTemplates, so the
base wiring that folds them into processResources must not also apply. Routing them
through processResources would subject them to the **/*.gsp exclusion
that keeps compiled views out of build/resources/main, silently dropping GSP
templates such as the ones generate-views and s2ui-override render from.