@groovy.transform.CompileStatic class GrailsGradlePlugin extends GroovyPlugin
The main Grails gradle plugin implementation
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
APPLICATION_CONTEXT_COMMAND_CLASS |
| Type | Name and description |
|---|---|
java.util.List<java.lang.Class<Plugin>> |
basePluginClasses |
java.util.List<java.lang.String> |
excludedGrailsAppSourceDirs |
java.util.List<java.lang.String> |
grailsAppResourceDirs |
| Constructor and description |
|---|
GrailsGradlePlugin(ToolingModelBuilderRegistry registry) |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
apply(org.apache.tools.ant.Project project) |
|
protected void |
applyBasePlugins(org.apache.tools.ant.Project project) |
|
protected void |
applyDefaultPlugins(org.apache.tools.ant.Project project) |
|
protected void |
applySpringBootPlugin(org.apache.tools.ant.Project project) |
|
protected FileCollection |
buildClasspath(org.apache.tools.ant.Project project, Configuration[] configurations) |
|
protected FileCollection |
buildClasspath(org.apache.tools.ant.Project project, java.lang.String[] configurationNames) |
|
protected void |
configureApplicationCommands(org.apache.tools.ant.Project project) |
|
protected void |
configureAssetCompilation(org.apache.tools.ant.Project project) |
|
protected void |
configureConsoleTask(org.apache.tools.ant.Project project) |
<T extends JavaForkOptions & DefaultTask> |
protected void |
configureForkSettings(org.apache.tools.ant.Project project, java.lang.String grailsVersion) |
|
protected void |
configureGrailsSourceDirs(org.apache.tools.ant.Project project) |
|
protected void |
configureGroovy(org.apache.tools.ant.Project project) |
|
protected void |
configureJavaCompatibilityArgs(org.apache.tools.ant.Project project)Configures JVM arguments required for compatibility with Java 23+. |
|
protected void |
configureMicronaut(org.apache.tools.ant.Project project) |
|
protected void |
configureProfile(org.apache.tools.ant.Project project) |
|
protected void |
configureRunCommand(org.apache.tools.ant.Project project) |
|
protected void |
configureRunScript(org.apache.tools.ant.Project project) |
|
protected void |
configureToolchainForForkTasks(org.apache.tools.ant.Project project)Configures JavaExec tasks to inherit the project's Java toolchain. |
|
protected Task |
createBuildPropertiesTask(org.apache.tools.ant.Project project) |
|
protected TaskProvider<JavaExec> |
createConsoleTask(org.apache.tools.ant.Project project, TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) |
|
protected TaskProvider<Task> |
createNative2AsciiTask(TaskContainer tasks, java.lang.Object src, java.lang.Object dest) |
|
protected TaskProvider<JavaExec> |
createShellTask(org.apache.tools.ant.Project project, TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) |
|
protected void |
enableNative2Ascii(org.apache.tools.ant.Project project, java.lang.String grailsVersion)Enables native2ascii processing of resource bundles |
|
protected void |
excludeDependencies(org.apache.tools.ant.Project project) |
|
protected java.lang.String |
getDefaultProfile() |
|
protected groovy.lang.Closure<java.lang.String> |
getGroovyCompilerScript(GroovyCompile compile, org.apache.tools.ant.Project project) |
|
protected static Provider<java.lang.String> |
getMainClassProvider(org.apache.tools.ant.Project project) |
|
protected boolean |
isGrailsSourceDirectory(java.io.File subdir) |
|
protected void |
registerFindMainClassTask(org.apache.tools.ant.Project project) |
|
protected GrailsExtension |
registerGrailsExtension(org.apache.tools.ant.Project project) |
|
protected void |
registerToolingModelBuilder(org.apache.tools.ant.Project project, ToolingModelBuilderRegistry registry) |
|
protected FileCollection |
resolveClassesDirs(SourceSetOutput output, org.apache.tools.ant.Project project) |
|
protected java.util.List<java.io.File> |
resolveGrailsResourceDirs(org.apache.tools.ant.Project project) |
|
protected java.util.List<java.io.File> |
resolveGrailsSourceDirs(org.apache.tools.ant.Project project) |
|
protected java.lang.String |
resolveGrailsVersion(org.apache.tools.ant.Project project) |
Configures JVM arguments required for compatibility with Java 23+.
Java 24 introduced restrictions on native access (JEP 472) that cause
warnings from libraries such as hawtjni (used by JLine) and Netty that call
System.loadLibrary or declare native methods. The
--enable-native-access=ALL-UNNAMED flag suppresses these warnings and
will become mandatory in a future JDK release when the default changes to deny.
Java 23 began terminal deprecation of sun.misc.Unsafe memory-access
methods (JEP 471/498). Netty 4.1.x uses Unsafe.allocateMemory
for off-heap buffers. The --sun-misc-unsafe-memory-access=allow flag
suppresses the resulting warnings until Netty migrates to MemorySegment
APIs (Netty 4.2+).
Both flags are only added when the target JVM version (from the configured
toolchain, or the JVM running Gradle if no toolchain is set) is high enough to
recognize them, avoiding Unrecognized option errors on older JDKs.
project - the Gradle projectConfigures JavaExec tasks to inherit the project's Java toolchain.
Gradle's JavaPlugin already sets toolchain conventions on
JavaCompile, Javadoc, and Test tasks, but does
not set them on JavaExec tasks. This means forked
JVM processes (dbm-* migration tasks, console, shell, and application
context commands) use the JDK running Gradle instead of the project's
configured toolchain. When the project targets a different JDK version
than the one running Gradle, this causes UnsupportedClassVersionError
or silent runtime failures.
This method only acts when the user has explicitly configured a toolchain
via java.toolchain.languageVersion. When no toolchain is configured,
behavior is unchanged - tasks use the JDK running Gradle as before.
Uses convention() so that individual tasks can still override
the launcher via javaLauncher.set(...) if needed.
project - the Gradle projectEnables native2ascii processing of resource bundles