@groovy.transform.CompileStatic class GrailsCliGradlePlugin extends java.lang.Object implements Plugin<Project>
Configures the CLI tier of a Grails application or plugin project: the grailsCli
configurations (with automatic discovery of companion -cli artifacts advertised by the
dependency graph), the per-command tasks, the generic runCommand/runScript
tasks, and the interactive console/shell tasks. Applied automatically by the
Grails Gradle plugin.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
APPLICATION_CONTEXT_COMMAND_CLASS |
|
static java.lang.String |
GRAILS_CLI_AUTO_PROVISION_PROPERTY |
Set this project property to false to stop the plugin from auto-provisioning the
CLI tier onto GRAILS_CLI_CONFIGURATION; equivalent to
grails { cliAutoProvision = false }. |
static java.lang.String |
GRAILS_CLI_CLASSPATH_CONFIGURATION |
The resolvable view of GRAILS_CLI_CONFIGURATION used by the command-runner tasks |
static java.lang.String |
GRAILS_CLI_CONFIGURATION |
The dependency bucket carrying CLI-only dependencies (Grails commands and their libraries): compile-visible so `grails-app/commands` sources compile against the cli-only contract, on the command-runner classpath, but never on `runtimeClasspath`, `bootRun`, or packaged artifacts. |
static java.lang.String |
GRAILS_CLI_DETECT_CONFIGURATION |
The internal probe configuration used to detect companion `-cli` modules |
static java.lang.String |
GRAILS_COMMAND_GROUP |
The task group the CLI command tasks are placed in. |
| Constructor and description |
|---|
GrailsCliGradlePlugin() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
apply(Project project) |
|
protected void |
autoProvisionCliDependencies(Project project, DependencySet dependencies)Auto-provisions the CLI tier onto grailsCli: the command contract and runner, plus
every companion -cli artifact advertised by a dependency of the application. |
|
protected void |
configureApplicationCommands(Project project) |
|
protected void |
configureConsoleTask(Project project) |
|
protected void |
configureGrailsCliConfiguration(Project project)Registers the `grailsCli` dependency bucket and its resolvable `grailsCliClasspath` view. |
|
protected void |
configureRunCommand(Project project) |
|
protected void |
configureRunScript(Project project) |
|
protected TaskProvider<JavaExec> |
createConsoleTask(Project project, TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) |
|
protected TaskProvider<JavaExec> |
createShellTask(Project project, TaskContainer tasks, NamedDomainObjectProvider<Configuration> configuration) |
|
protected Dependency |
findAdvertisedCliArtifact(Project project, ResolvedArtifactResult artifact)Returns the Dependency on the companion cli artifact advertised by the given resolved artifact, or null if it advertises none. |
|
protected Dependency |
findProjectCliCompanion(Project project, ProjectComponentIdentifier componentIdentifier)Binds a companion advertised by a project of the current build as a project dependency on its cli feature capability, or returns null when the component is not a
resolvable project of the current build (an included-build project, or a coincidental
same-named project). |
|
protected java.util.Collection<java.lang.String> |
loadCommandNamesFromCliClasspath(Project project)Loads command class names from the META-INF/grails-cli.factories files of the
resolved grailsCliClasspath jars, so per-command Gradle tasks (e.g. |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
Set this project property to false to stop the plugin from auto-provisioning the
CLI tier onto GRAILS_CLI_CONFIGURATION; equivalent to
grails { cliAutoProvision = false }.
The resolvable view of GRAILS_CLI_CONFIGURATION used by the command-runner tasks
The dependency bucket carrying CLI-only dependencies (Grails commands and their libraries): compile-visible so `grails-app/commands` sources compile against the cli-only contract, on the command-runner classpath, but never on `runtimeClasspath`, `bootRun`, or packaged artifacts.
The internal probe configuration used to detect companion `-cli` modules
The task group the CLI command tasks are placed in. A group makes them visible in the
default gradle tasks listing (and therefore to shell tab-completion), matching the
commands offered by the interactive Grails shell.
Auto-provisions the CLI tier onto grailsCli: the command contract and runner, plus
every companion -cli artifact advertised by a dependency of the application. A
module advertises its companion through the Grails-Cli-Artifact manifest attribute
of its runtime jar (stamped by the framework's cli-artifact build convention; third-party
plugins set it on their jar task). Discovery walks the full dependency graph (including
transitive plugins) through a lenient resolution of an internal probe configuration.
Disable with grails { cliAutoProvision = false }.
Registers the `grailsCli` dependency bucket and its resolvable `grailsCliClasspath` view.
`grailsCli` carries the CLI tier — command companion artifacts (`
Returns the Dependency on the companion cli artifact advertised by the given
resolved artifact, or null if it advertises none.
A companion produced by a project of the current build is bound as a project
dependency requesting the project's cli feature capability, so it resolves against
the sibling project's not-yet-published variant instead of a repository (the multi-project
plugin-development workflow). Everything else — external modules and projects of an included
(composite) build — is bound to the plain group:artifactId module coordinate read
from the resolved jar's Grails-Cli-Artifact manifest attribute.
Binds a companion advertised by a project of the current build as a project dependency on
its cli feature capability, or returns null when the component is not a
resolvable project of the current build (an included-build project, or a coincidental
same-named project). The companion coordinate comes from the project's cliArtifactId
property exported by the cli-artifact convention, so the (possibly not-yet-built) jar is
never read.
Loads command class names from the META-INF/grails-cli.factories files of the
resolved grailsCliClasspath jars, so per-command Gradle tasks (e.g. dbmUpdate)
are registered for auto-provisioned cli artifacts. Resolution is lenient and jars that are
not built yet (project dependencies within a composite) are skipped — the generic
runCommand task can always execute those commands regardless.