@org.gradle.api.tasks.CacheableTask @groovy.transform.CompileStatic abstract class GenerateNativeMetadataTask extends DefaultTask
Records the application's own classes so they survive into a native image.
Grails reaches an application's artefacts reflectively -- a controller's actions, a domain class's properties, a tag library's methods -- and a precompiled page is looked up by the name recorded for its view. A native image keeps only the members something asks for, so without this the classes are present but unusable.
The answer is already in the build output: the compiled classes are on disk and the pages are listed in the manifest the GSP compiler writes. Reading them here means an application does not have to run under the tracing agent to be buildable, which matters because the agent records only the paths that were exercised -- a page never visited during the trace is a page missing from the image.
| Type | Name and description |
|---|---|
static java.lang.String |
METADATA_PATHWhere the generated metadata is written within the artifact. |
static java.lang.String |
VIEWS_MANIFESTThe manifest the GSP compiler writes, mapping a view to the class it compiled to. |
| Constructor and description |
|---|
GenerateNativeMetadataTask() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
generate() |
|
abstract ConfigurableFileCollection |
getClassesDirs()Compiled application classes. |
|
abstract DirectoryProperty |
getOutputDirectory() |
|
abstract ConfigurableFileCollection |
getPageClassesDirs()Compiled pages, including the manifest naming them. |
|
abstract ConfigurableFileCollection |
getPageClasspath()The classpath whose artifacts may carry their own pages. |
Where the generated metadata is written within the artifact.
The manifest the GSP compiler writes, mapping a view to the class it compiled to.
Compiled application classes.
Compiled pages, including the manifest naming them.
The classpath whose artifacts may carry their own pages. A plugin ships compiled pages and the manifest naming them, and an application renders those as readily as its own.