Repository navigation
Make Grails Forge the one generator and grails the one command line - #17114
jdaugherty wants to merge 755 commits into
Conversation
|
I've made some changes to significantly speed up the forge build & associated tests. This should reduce the time from 1hr 20 min to significantly less. |
End-to-end journeys, by hand, at d1c26f6 (findings fixed in 72c18eb)The journeys the review of 2026-11-22 asked for, run once every review item was addressed. macOS, JDK 21.0.12. The command line is the distribution built from this head ( 1. A real Grails 8 application, upgraded. Created by the released Grails 8.0.0 ( 2. A generated application, edited, given a feature, built and run. 3. The catalog, 4. A fresh wrapper from the staged distribution. In the application of journey 2, with only Java on the 5. Windows. Not run by hand. The Windows jobs of this pull request (the Forge specifications, the core build) passed at 7739cc5; the runs of the later heads are in CI. 6. The IDE. apache/grails-intellij-plugin#477 (draft) supports this command line in the IntelliJ plugin; it was not run in an IDE. Found by the journeys, and fixed in 72c18ebEach re-run by hand with the distribution of 72c18eb:
Verification at 72c18eb, besides the runs above: |
A tour of this change, by common scenarioWhat this pull request changes for a user, scenario by scenario, with the class that implements each. Links are pinned to The big pictureGrails 8 had two command lines (the Grails shell with profiles, and the Forge CLI). Grails 9 keeps Forge, calls it
Code: Scenario 1: Create a new application$ grails create-app com.example.shop --features grails-quartz --exclude-features mockito
$ grails create-restapi api # was: create-app --profile rest-api
$ grails create-rest-api-plugin audit # new type; was --profile rest-api-plugin
$ grails create-app --list-features # (+) marks defaultsWhat's different:
What a feature looks like now, e.g. kind: feature
name: grails-quartz
compatibility: { grails: '[9.0.0,10.0.0)', forge: '[9.0.0,10.0.0)' }
dependencies:
- scope: implementation
coordinates: org.apache.grails:grails-quartz
configuration:
quartz.autoStartup: trueA pack can only add (dependencies, config, rendered files). It can't overwrite another feature's setting or a dependency version; conflicts fail with both sides named. Scenario 2: What's in the new project (
|
| File | Holds |
|---|---|
.grails/project.yml |
What was asked for: type, name, package, options, requested/excluded features |
.grails/forge.lock.yml |
What that resolved to: Grails version, every applied feature in order, generator build digest |
.grails/baseline/ |
A copy of every generated file, as generated |
Commit it (the baseline is the merge ancestor for Scenario 6), don't edit it (the files carry each other's digests; a hand-edited record is refused), and the running app never reads it. Code: ProjectStateRecorder, ProjectState.
Scenario 3: Create classes
$ grails create-domain-class Book # + BookSpec
$ grails cDC Author # short forms still work…
$ grails cdc Author # …now in lower case too
$ grails cC Book # refused (exit 2): fits create-controller and create-command
$ grails create-job Nightly # exists only because the record has grails-quartz- The command list depends on the record:
create-jobneedsgrails-quartz;create-restful-controlleronly in REST types;create-functional-testwrites Geb or HTTP tests by type. - An existing file fails without
--force(Grails 8 silently kept it and exited 0). - An ambiguous short form runs neither and names the shortest form of each (Grails 8 ran the first match). Code:
ShortForms. create-unit-test BookSpecwritesBookSpec.groovy, notBookSpecSpec.groovy.
Scenario 4: Build, test, run
grails |
Gradle |
|---|---|
compile |
classes |
test-app |
testApp, which runs every test phase |
run-app |
bootRun |
assemble / war / package |
assemble (production) |
gradle ARGS… |
exactly those args |
$ grails test-app # unit + integration + functionalTest + any other Test task
$ grails test-app --unit --integration # what Grails 8's test-app ran
$ grails test-app BookSpec # runs it in whichever phase has it
$ grails run-app -Dgrails.env=test # was: grails test run-app (now exit 2)
$ grails run-app --detach && grails stop-app
$ grails compile -- --offline # after -- goes to Gradle verbatimtest-appnow includes functional tests, the most likely surprise. Code:TestAppTask.- The environment goes after the command;
prod waror a leading-Dis refused. run-app --detachreturns once the app answers on its port (read fromapplication.yml); with the startup-progress page, a failed start is reported at once.stop-apponly stops whatrun-appstarted (PID + start time + user + command line recorded in.grails/run).- A project above the current directory is used only if you own it (
GRAILS_SAFE_DIRECTORYfor exceptions; see the threat model).
Scenario 5: Commands of the application and its plugins
$ grails create-command data-import # grails-app/commands/.../DataImportCommand.groovy
$ grails data-import orders.csv # top-level, by name
$ grails s2-quickstart com.example User Role # plugin command, by name
$ grails help data-import # describes; runs nothing
$ grails run-command -Dgrails.env=production dbm-updateHow it works: every build that compiles the project runs grailsCommandCatalog → .grails/cache/command-catalog.json, which grails reads without starting Gradle (so help stays instant). Typing a name not yet listed (fresh checkout, just after create-command) makes the build list once, then retry. The command runs in the build via the runCommand task with the application context over a mock servlet, or without the application if the class implements StandaloneCommand (query-tail is one). Code: GrailsCommandCatalogTask, ApplicationCommands.
The gotcha: everything after an app command's name is the command's own, so grails dbm-update -Dgrails.env=production runs in development (with a warning). Use run-command for the environment.
Scripts: deprecated. Existing src/main/scripts still run (via runScriptCommand, with a warning); create-script is removed in favour of create-command. The framework's own scripts became compiled commands (Spring Security s2-*, scaffolding, query-tail), and Quartz/Geb's scripts became create-job / create-functional-test. s2-quickstart now writes nothing if any environment already has a setting it would write, unless --force.
Plugin authors: commands go in src/cli/groovy with the grails-plugin-cli Gradle plugin, published in a companion artifact so they stay off the app's runtime classpath.
Scenario 6: Add a feature months later
$ grails feature list # has / can add / why it can't add the rest
$ grails feature add cache --dry-run # or --diff for line-by-line
$ grails feature add postgres
| Adding the feature postgres, and with it testcontainers
postgres replaces h2, the default of the group database-driver
merge build.gradle (your changes are kept)
...
$ grails feature add mysql --replace # postgres was asked for by name, so --replace is requiredHow it works (FeatureAddition, ThreeWayMerge, ProjectTransaction):
- Replay. Generate the app twice in memory: from the record, which must reproduce
.grails/baselinebyte for byte, and with the new feature. - Three-way merge per differing file, with baseline as ancestor, new generation as theirs, and your working copy as yours. An untouched file is updated, a file edited elsewhere is merged, and the same lines changed on both sides is a conflict. One conflict means nothing is written.
- All or none. Files are staged and renamed into place with a journal under
~/.grails/forge/transactions/…; an interrupted change is finished or undone file by file, never over a later edit.
Rules: a default the feature displaces is replaced (postgres → h2); a feature you asked for only with --replace; an option (--data, …) is never changed; nothing is removed on request; the Grails version never moves. It needs a tracked record (one Grails 9 generated). If the project used an external pack or preset, pass the same pack again so the replay matches.
Scenario 7: "What did we change?" and "is this project healthy?"
$ grails project show # every option (default or not) + the create-app line that rebuilds it
$ grails project regenerate --diff # added/changed vs. generation; exit 1 if anything differs
$ grails project regenerate --output /tmp/pristine
$ grails project health --strict # offline checks with stable ids; --json for CIproject health checks Grails/Gradle/Java versions, both wrappers and the Gradle checksum, removed or deprecated dependencies, the record, Git files, the command catalog, leftovers of earlier versions, and agent skills. Each finding has a level, the fix, and the upgrade note. Code: ProjectHealth.
Scenario 8: Upgrade a Grails 8 application
# 1. set grailsVersion=9.x in gradle.properties
$ ./grailsw update-wrapper # old wrapper replaces itself; commit grailsw, grailsw.bat, grails-wrapper.jar
$ ./grailsw project migrate # writes an *untracked* record from the project's files
$ ./grailsw project health --strict # repeat until cleanWhy the old wrapper works: every wrapper since Grails 7 starts DelegatingShellApplication. A Grails 9 wrapper sets grails.wrapper.version; an old one doesn't, so the class sets grails.cli.earlierWrapper=true and GrailsCli.mainOfEarlierWrapper runs update-wrapper first.
After migrating, an untracked record gives you the create-* class commands but not feature add or regenerate (no baseline to merge against; adoption via project init is not built). Until migrated, a pre-9 project refuses project commands (exit 1, one line), except project migrate and project health. Upgrade note 55 in upgrading90x.adoc maps every Grails 8 command line to Grails 9; grails-skills/upgrade/skills/grails-upgrade/SKILL.md walks the same steps.
Scenario 9: Interactive console
$ grails
grails> create-service Inventory
grails> run-app # returns to the prompt once the app answers
grails> !git status # ! runs a shell command, as in the old shell
grails> exit # or quitBuilds go through the Tooling API on one kept connection; Ctrl-C cancels the build and returns to the prompt; TAB completes commands and, after feature add, the features the project lacks.
Scenario 10: Tools, CI and IDEs
- Exit codes: 0 done, 2 command-line mistake (nothing ran), 1 anything else.
--plain-output,--non-interactive,help --json(every command, option, value and rule),--jsonon theprojectcommands;bin/grails_completionfor bash and zsh.- IntelliJ needs Support the Grails 10 command line for projects of Grails 10 and later grails-intellij-plugin#477 for a Grails 9 project. Without it, IntelliJ has no Grails commands for the project, because the plugin starts the removed shell.
What's gone
grails-shell-cli and the seven profile artifacts (a profile dependency fails the build); -t/--type; GRAILS_PREFERRED_SHELL; grails.profile; create-profile/list-profiles/profile-info; create-script; open (use !open); the test alias; install (use gradle publishToMavenLocal); grails run app.groovy (use run-script); ~/.grails/settings.groovy (proxies go in GRAILS_OPTS); REST scaffolding into JSON views. -v is now --verbose (the version is --version / -V).
External dependencies and limitations
- Record the Forge feature pack of a plugin version in the plugin index grails-plugins-metadata#326 has to be merged, and the index written again, before a plugin's feature can be selected by name; until then use the plugin's coordinates. Grails' own 61 packs don't depend on it.
- Neo4j can't combine with Hibernate 7 or Micronaut;
cache-ehcacheresolves to5.0.0-RC1and is only compile-checked; not yet verified against an ASF-staged release.
Suggested reading order
tour.adoc, then upgrade note 55, then FORGE-CLI-DESIGN.md §3, then FeatureAddition.groovy and GradleBuild.groovy, where the hardest logic lives.
How to test locallyThese steps build this branch into a
You need JDK 21 and 1. Build and installgh pr checkout 17114
./gradlew publishAllToMavenLocal # grails-gradle, the framework, and Forge with the grails-cli jar the wrapper downloads
(cd grails-forge && ./gradlew :grails-cli:installDist)
export PATH="$PWD/grails-forge/grails-cli/build/install/apache-grails-bin/bin:$PATH"
export GRAILS_REPO_URL="$(mktemp -d)" # where generated builds and the wrapper find 9.0.0-SNAPSHOT
mkdir -p "$GRAILS_REPO_URL/org/apache" && cp -R "$HOME/.m2/repository/org/apache/grails" "$GRAILS_REPO_URL/org/apache/"
export GRAILS_WRAPPER_HOME="$(mktemp -d)" # an empty wrapper cache, so the wrapper really downloads
export GRAILS_SAFE_DIRECTORY="$GRAILS_REPO_URL" # a standalone tool is started only from a directory you trust; the staged repository is one
grails --version
Keep the four variables set in every terminal you test in. A generated application records 2. A new application, with the command linecd "$(mktemp -d)"
grails create-app com.example.shop && cd shop
git init -q && git add -A && git commit -qm generated
cat .grails/project.yml # the record: type, options, features
grails create-domain-class Book
echo '// a change of my own' >> build.gradle
grails feature find cache # the features with "cache" in their name or description
grails feature show cache # what it is and what it would add here
grails feature diff cache # the diff feature add would apply; writes nothing
grails feature add cache --dry-run # "merge build.gradle (your changes are kept)"; writes nothing
grails feature add cache
git status --short
grails project regenerate --diff # exit code 1: build.gradle changed, the Book files added
grails project show # ends with the create-app line that makes the same application
grails project health
grails create-tool report # a tool in src/cli/groovy, run by the build
grails create-tool --standalone stamp # a tool in src/standalone/groovy, run as a process of its own, without Gradle
grails report && grails stamp
grails help # the tools are listed in a section of their own
grails test-app
grails run-app --detach # returns once http://localhost:8080 answers
grails stop-app
grails # the console: try run-app, !git status, exitA few of the refusals, with their exit codes, run in the same directory: grails prod war; echo $? # 2: the environment goes after the command (war -Dgrails.env=production)
grails -t forge create-app x; echo $? # 2: there is one command line
grails cC Book; echo $? # 2: cC fits create-controller and create-command
grails help --json | head -c 4003. The Grails wrapper of that applicationenv PATH="/usr/bin:/bin" ./grailsw --version # only Java (from JAVA_HOME): downloads grails-cli-9.0.0-SNAPSHOT-all.jar
ls "$GRAILS_WRAPPER_HOME"
./grailsw help
./grailsw run-app --detach && ./grailsw stop-app4. A Grails 8 application, upgraded by its own wrapperStart from a Grails 8.0.0 application that has cd legacy
# in gradle.properties: grailsVersion=9.0.0-SNAPSHOT
# in build.gradle: delete the profile "org.apache.grails.profiles:..." line, if there is one (upgrade note 39)
# in build.gradle and settings.gradle: add maven { url = uri(System.getenv('GRAILS_REPO_URL')) } first in every repositories block (only a snapshot needs this)
./grailsw update-wrapper # the 8.0.0 wrapper downloads the Grails 9 command line, which replaces the wrapper
git status --short # grailsw, grailsw.bat and grails-wrapper.jar (now about 41 KB) changed
./grailsw --version # Grails Version: 9.0.0-SNAPSHOT, through the new wrapper
./grailsw project migrate # writes .grails: the record and a baseline of what Grails 9 generates for what it found; changes no other file
./grailsw project show # state: adopted
./grailsw project health
./grailsw compile
./grailsw create-controller Book
./grailsw feature add cache # added: build.gradle and application.yml merged, your own lines kept
./grailsw feature add openapi --dry-run # a conflict that names the lines, and writes nothing: one of the changes that still need a hand
./grailsw compileCleaning uprm -rf "$GRAILS_WRAPPER_HOME"The Not covered by these steps:
|
4100b57 to
cddda1a
Compare
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. A script whose file name is the command with a capital letter in the middle is not found in a jar.
codeconsole
left a comment
There was a problem hiding this comment.
Impressive work overall — the architecture, documentation, test coverage, and security hardening across grails-forge, grails-wrapper, grails-gradle, and the migrated plugin commands are remarkably thorough.
I'm requesting changes for a handful of concrete bugs found during review (detailed in the inline comments):
- Console / CLI: JLine
Terminalleak inInteractiveShell.start(), uncaughtInterruptedExceptioninConsoleProgram.run()when interrupted in non-inherited mode, andForgeCli.refusedIn()bypassing Grails 7/8 refusal when-V/--versionappears after a command. - ReDoS in
project health/project regenerate: consecutive*/**wildcards in.gitignoreand.gitattributesare not collapsed before regex compilation. - Parallel build race:
TestRepositoryMarkerPlugin.InvalidateMarkerhas a TOCTOU race onmarker.exists() && !marker.delete()across parallel publish tasks. - Additional minor bugs:
StartClass.loadleakingURLClassLoaderon error paths and misreportingIOExceptionas a missing start class,RunAppCommandnon-volatile shutdown-hook fields,JCacheGrailsCacheManagermasking non-raceCacheExceptionasIllegalArgumentException,S2QuickstartCommandmulti-linedoWithSpring()/ duplicate insertion handling,S2uiOverrideCommanderror message when passing a package tolayout/auth, unremoved shutdown hook inQueryTailCommand, unclosedHttpClientinPackArtifacts, Windowsstderr.encoding/ UNC URI / missing task input issues, and minoractions/*tag version drift in workflows.
Also note that Coverage - grails-forge (ubuntu-24.04) failed on ToolingApiRunAppSpec (likely timing under JaCoCo instrumentation, as the non-coverage Forge jobs passed).
jdaugherty
left a comment
There was a problem hiding this comment.
@jamesfredley @codeconsole: every finding of reviews 6042723725 and 6044167874 is fixed at f4b4068. Each thread has the commit and the spec that covers it.
Two fixes go further than the suggestion:
- The
.gitignore/.gitattributespatterns are matched without a regular expression. Collapsing*alone still leaves*a*a…*bslow. - A script of a plugin is found in a jar without directory entries by listing the jar, not by another name guess. The order no longer follows the class path: Grails' jars first, then the rest by jar name and file name.
Coverage - grails-forge: ToolingApiRunAppSpec waited the full 300 s although run-app had already ended (its record .grails/run/app.json was gone, and run-app deletes it when the build ends), so it was not slowness under JaCoCo. The spec now stops waiting as soon as run-app ends and prints its exit code and output (aabb5c4). freePort() also requires that the port can be bound on the loopback address without SO_REUSEADDR, since another process can hold a port there that looks free on the wildcard address. It passed locally, so if it fails again the output will say why.
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. A subclass that sets its own command name is recorded under the name it inherited.
jdaugherty
left a comment
There was a problem hiding this comment.
@jamesfredley: the finding of review 6045650689 is fixed at 17ef512 (52a4314). The thread has the commit and the specs that cover it.
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. A subclass that sets its command name in a helper is still recorded under the inherited name.
A base command sets its name to old-name, and the constructor of a command that extends it calls a helper that sets the name to import-data. The descriptor, and so the catalog, said old-name, while the registry of commands, where runCommand looks the name up, knows the command as import-data: the writer looked for statements that set the property in the constructors and initializer blocks only, and code they call was not seen. Any other way of setting it there was not seen either: a method of a class the command extends, an overridden method the constructor of the base class calls, a field initializer that calls a method, a trait that gives its fields values, a method of the runtime, reflection. The writer now follows what runs when the command is made, in the order it runs, from the class at the root down to the command: of each class its field initializers, its initializer blocks and each constructor, and the methods that code calls on the command, or the static methods of its classes it gives the command to, when they are compiled with it. A method is found as Groovy finds it: a private method of the class that calls it, of methods with the same parameters the one nearest to the command, every method the call can mean otherwise; at most 16 calls deep and 256 calls for a property. The last statement that sets the property to a string constant on every way the code can go decides, so name = 'a'; name = 'b' is now b where it gave no descriptor. Anything that can set the property and is not read makes it unknown, and the command gets no descriptor: a condition, a value given to the method that sets it, recursion, a loop or try, this(...), a closure or with, a method of another class or of a class compiled elsewhere, one of the runtime (setProperty, a subscript, the meta class), reflection, a trait other than those of the command contract that gives its fields values, a class that overrides getProperty, setProperty, invokeMethod, methodMissing or propertyMissing. Code that is not read and is not given the command, such as new JsonSlurper(), cannot reach it and leaves the property as it is, until the command has been handed to code that is not read (a closure holds it; a class compiled elsewhere that it extends may have handed it out); from then on any code that is not read makes the property unknown. Changes to the meta class, methods of extension modules and other threads are not seen. A command without a descriptor is listed by the name its class name gives, which need not be the name it has: runCommand did not find it by the name it was listed by. findCommand of the registry now finds a command by that name when no command has it as its own name; of two classes that give the name, the one without a descriptor, which is the one the catalog lists by it. A command of a Grails 7 plugin, listed the same way, is found by the class of the command its adapter adapts. CommandDescriptorWriterSpec compares, for each way of setting the name (helpers private, final, overridable and static, helpers calling helpers, a helper of the class extended, an override the base calls, a field initializer, a conditional helper, closures, with, another class, the runtime, a subscript, the meta class, reflection, a trait, code the command was handed to), the descriptor or its absence with the name the command has when it is made, and lists a command without a descriptor and finds it by that name. ApplicationCommandProviderSpec and LegacyCommandRegistryLoadingSpec find commands by the names their classes give. GeneratedApplicationCommandSpec runs, in a generated application, the command of the review and one whose name is worked out, by the names the build lists them by. The guide says what the descriptor reads and that a command listed by its class name runs by it. Part of apache#16348
Upgrade note 32, the upgrade skill and revision 107 of the design say which settings of a command's name the descriptor reads, and that a command listed by the name its class name gives also runs by it. Part of apache#16348
codeconsole
left a comment
There was a problem hiding this comment.
Merge after the fixes. Published Grails 9 command jars can break, feature addition can undo a permission change, and verification can fail spuriously or reuse a stale result. Keep forgePackTest simpler by letting the nested Gradle builds own up-to-date checks once fixture generation and execution can run separately. This was a source review. The PR materials included directions to build the branch and invoke TestLens. I left them unexecuted.
… so that a command compiled with Grails 8 or 9 runs
…s not written as one
jdaugherty
left a comment
There was a problem hiding this comment.
@codeconsole, review 6177815872 (at cef9323) is answered at a7da44a, each finding in its thread:
- Commands compiled with Grails 8 or 9 did not load. The two deprecated traits have their members again, and a spec runs commands compiled against the Grails 9 traits through the real runner.
- A mode changed between staging and write ends the change and is kept.
forgePackTestruns each time it is asked for. @jamesfredley, this is also the answer to your thread on the same line.- The duration comparison of
McpModernEraSpecis removed. - A malformed
--feature-optionwith--jsonends with 2, with the reasonfeature-option. - The stand-in rows of
ConsoleCommandsSpecare unchanged: the behaviour of the build is tested inTestAppFunctionalSpec.
Run locally: :grails-core:testCli, :grails-console:test, ProjectTransactionFailuresSpec, FeatureAdditionSpec, FeatureAddJsonSpec, McpModernEraSpec, the ForgePackTest specs of the Gradle plugins, and codeStyle of the touched modules. The six commits are unsigned.
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. A customized artifact name is not the name the metadata asks for, and a command class loses the name callers already use.
codeconsole
left a comment
There was a problem hiding this comment.
Existing command names can disappear or run a different command. Feature addition can override a migrated application's environment settings, and published CLI companions can have an unresolvable dependency. The supplied CI report also leaves the linked-wrapper startup failure unexplained.
This was a source review. The PR materials asked readers to check out and build the branch and to invoke TestLens. I used the supplied files and CI report.
Merge after the fixes and a passing linked-wrapper check.
|
|
||
| where: | ||
| project | directories | build | ||
| 'an integrationTest task that takes its sources from src/it/groovy' | ['src/it/groovy'] | "\ntasks.named('integrationTest') { inputs.dir('src/it/groovy') }\n" |
There was a problem hiding this comment.
The two rows can be one forwarding test. inputs.dir does not configure test sources, and the stand-in testApp echoes the phase in both rows. Put the custom-source case in TestAppFunctionalSpec with a real test under src/it/groovy and assert that it ran.
In an application that project migrate adopted, feature add puts the settings a feature adds to a YAML file under grails-app/conf into a document of their own at the end of the file when the line merge finds no place for them, and only when no document of the file sets one of those keys, or a key above or below one. That check compared the keys as they are written, so a key under environments.<name> was taken for another setting. Grails reads each document of application.yml with the settings under environments.<name> of the environment it runs in put in the place of the others of that document, and then merges the document over the documents before it (YamlPropertySourceLoader), so the document at the end won over a setting of an environment: an application with environments.development.grails.cache.enabled: false got the cache turned on in development by feature add cache, which said it had put in only what the file does not set. The check now reads a key under environments.<name> as that key in that environment, and a key outside environments as that key in every environment, in both directions: the file's setting of an environment against a key of the feature, and the file's key for every environment against a key the feature sets for one environment. Where they meet in an environment both are read in, the fallback is refused and the file is the conflict the line merge found, as for a key the file sets as it is written, and nothing is written. Keys of two different environments do not meet, and the name of an environment may contain a dot. The specs compute what the application gets in each environment, before and after the feature is added, with the YamlPropertySourceLoader of the framework. The guide says how the documents are read and which keys count. Part of apache#16348
…dinate
The companion -cli of a plugin depends on the plugin's own -cli-standalone, and it
required that companion by the capability of the conventional name,
<project>-cli-standalone. The published module metadata of -cli takes the module of
that capability, so a plugin with cliArtifact { standaloneArtifactId = 'acme-files' }
published a -cli whose module metadata named my-plugin-cli-standalone, an artifact that
was never published: a build that resolved the -cli from the repository failed with
"Could not find". The POM was right, as dependency mapping wrote the resolved
coordinate into it.
The dependency now requires the capability of the configured standaloneArtifactId,
read when the dependencies are resolved, after the build script has set it and the
group. A customized coordinate is a capability of the variants of the companion
already, so the build resolves it as before, and the module metadata and the POM of
-cli both name the coordinate that is published.
CustomCompanionCoordinatesSpec publishes the plugin with the default names, a custom
artifactId, a custom standaloneArtifactId and both, checks the POM and the module
metadata of -cli, and resolves the published -cli from a separate Gradle build, once
from the module metadata and once from the POM alone, and the published plugin from an
application of that build. It also checks that an application of the same build gets
both companions by their coordinates.
Part of apache#16348
In a build that asks for testApp, the integration tests must run after the unit tests, and the other phases after both, unless the build script already has the earlier phase run after the later one. That check followed dependencies and mustRunAfter of any task, but looked for finalizers only among the Test tasks. A chain through a task that is no Test task was missed: with integrationTest finalized by cleanup and cleanup finalized by test, Gradle already runs integrationTest, cleanup, test, and testApp added integrationTest.mustRunAfter(test), which closed the cycle and failed the build with Gradle's circular dependency error. The check now looks for finalizers among every task of the project, and among the tasks of any project those are finalized by, transitively, so a chain through any number of tasks, of this project or of another, with dependencies, mustRunAfter and finalizers mixed, is seen. It is worked out once, when Gradle asks for the order, and only in a build that asks for testApp: that build configures every task of the project once. A task that cannot be configured, or whose dependencies cannot be resolved, is passed over, so the order is still never what fails a build. TestAppFunctionalSpec has the reviewer's case and its neighbours: a chain of two such tasks, the unit tests that must run after or depend on the last task of such a chain, a task asked for beside testApp that depends on or runs after the integration tests and is finalized by the unit tests, and a finalizer of another project. Each fails with the circular dependency error without the change. It also runs testApp in a build with a task that cannot be configured and with one whose dependency and finalizer are no tasks. Part of apache#16348
The command test-app no longer looks for src/integration-test: it asks the testApp task of the build for the phase, which runs the tests of the source set of the phase. Nothing tested a project whose integration tests are elsewhere. TestAppFunctionalSpec now has a project without src/integration-test whose build script gives the source set integrationTest the folder src/it/groovy, the way Gradle has a source set read another folder, with a Groovy test there that checks it runs with the system property of the integration phase. testApp --phase integration runs it: the test passed, its results are the only ones of integrationTest, and the unit tests did not run. The reference page of test-app says that a phase runs the tests of its source set, wherever they are. Part of apache#16348
…why it failed LinkedWrapperStopAppSpec waited for server.pid after run-app --detach had returned, for up to the bound of the specs, 300 seconds, and looked at the exit code of the command only afterwards. A start that failed before the stand-in build wrote the file was reported five minutes later as a file that did not appear, without what run-app printed or what the build wrote. That is how the feature failed once in CI, in the job of Java 21 with indy, and the report could not tell why. The application of the fixtures of LifecycleCommandsSpec, the stand-in build and the program of one file, opens its port, writes server.pid and only then takes a connection, and run-app --detach returns 0 only once an HTTP answer came from the port. When run-app has returned 0 after an answer of the application, server.pid is there, so nothing is to be waited for, and a missing file means that what answered was something else. DetachedStart, in the test sources, holds the start as soon as the command has returned: exit code 0, no error, server.pid written, its process alive and the port taking connections. Where one of these is not so, the failure says what there is to see: everything the command printed, the last lines of .grails/run/app.log, the record and the command lines of the processes it names, server.pid, what answers on the port at 127.0.0.1 and ::1, and which processes have the port, as lsof or else ss shows them. The processes the record and server.pid name are given to the cleanup of the feature first, so that a start that fails there leaves nothing running. LinkedWrapperStopAppSpec, the features of LifecycleCommandsSpec that waited for server.pid after a run-app they expect to start the application, and the feature of MultiProjectBuildSpec that read the record of the stand-in build before the exit code use it. Where stop-app fails in LinkedWrapperStopAppSpec, the line it said is shown before its exit code. Part of apache#16348
The feature of ConsoleCommandsSpec for test-app --integration had two rows: a project whose integrationTest task declared src/it/groovy as an input, and a project without integration tests. An input declares no test sources, and the stand-in testApp prints the phase it is given in both, so neither row showed that a test of other sources runs, or that a phase the project lacks is reported: both held what the command gives the task. They are one feature now, of a project without src/integration-test, which holds that the command asks the task for the integration phase as its option, refuses nothing for the missing directory and does not create it. A test under other sources that runs, and a phase the project lacks that fails the build with the phases it has, are for TestAppFunctionalSpec of the Grails Gradle plugin, which runs a real build. Part of apache#16348
A class that implements the deprecated ApplicationCommand, or GrailsApplicationCommand, and does not name itself had in Grails 8 and 9 the name its class name gives without the ending Command, and nothing else: ExportTool was export-tool. Grails 10 named it as a tool, without the ending Tool, so export-tool ran nothing, both for a class compiled again and for the jar of a plugin compiled with Grails 8 or 9, whose bridges call ApplicationCommand.getName() of this version. ApplicationCommand.getName() works the name out as Grails 8 and 9 did again (ToolDescriptor.commandConventionName), and GrailsApplicationCommand has a getName() of its own that does the same, since ToolSupport, which it implements after ApplicationCommand, would otherwise give it the name of a GrailsTool. The compiler records that name in the descriptor of a class whose getName() is one of these. Where only the name of a class and its registration are known, a class registered under the key org.apache.grails.core.cli.ApplicationCommand alone, as a companion of Grails 8 or 9 registers its commands, is named as such a command, and a class registered under the key of the tool contract as a tool (ToolDescriptor.registeredName). The catalog of the build, the registry of the runners and the Gradle task of each tool all name a class so; the task now takes the name of a descriptor too, where the jar has one, as the catalog does. A class that implements ApplicationTool and is named ExportTool stays export. The compiler's warning for a class that implements a deprecated type no longer says that nothing else changes where the class would lose -tool as an ApplicationTool: it says which name to return from getName() to keep it. The registry found a command by the name the catalog lists it by before the name commands give themselves, so a name a command of Grails 9 gave itself could run another command, the one whose class name gives that name. It now finds a command in this order: the tool whose descriptor gives the name; the command that gives itself the name when it is made, as Grails 8 and 9 found a command; and the command without a descriptor whose class name gives the name, the name the catalog lists it by. Where the name the catalog lists for one class runs another, or another command gives itself the name of a tool's descriptor, the runner of the build and the runner of standalone tools print one line before the tool runs that names both classes and the one that runs (ApplicationContextCommandRegistry.conflictOf). One row of ListedCommandNameSpec, and the rows of ApplicationCommandProviderSpec and ToolRegistryKeysSpec that expected the earlier rule, now expect this one. Part of apache#16348
…the health advice The design is at revision 154 with the changes of this review round. The upgrade notes and the upgrade skill say how a tool is found by a name, that a class of the deprecated command types keeps the name Grails 9 gave it, and when feature add puts YAML settings into a document of their own. The advice tools.legacy-type no longer says that nothing else changes for a class whose name ends with Tool. Part of apache#16348
jdaugherty
left a comment
There was a problem hiding this comment.
@jamesfredley, @codeconsole: reviews 6182414428 and 6194253123 (both at 04d62a0) are answered at 00c2ef8, each finding in its thread:
- Names of the commands of Grails 8 and 9. A class of the deprecated command types that ends with
Toolkeeps its name (ExportToolisexport-tool), at run time, in its descriptor, in the catalog and for its Gradle task. A command without a descriptor is found by its runtime name first, as in Grails 9, and a name the catalog lists for another class is said in one warning line. standaloneArtifactId. The-clicompanion depends on the standalone companion by its configured name, and a spec resolves the published companion from a separate Gradle build.feature addandenvironments. The YAML document at the end is refused where the file sets one of its keys for an environment.testAppand finalizers. The order check follows the finalizers of every task of the project.LinkedWrapperStopAppSpec. The exit code is checked first and a failed start reports its output. The cause of the one failure in CI is not established; its thread says what the log shows and what was tried.ConsoleCommandsSpec. The two rows are one forwarding test, and the custom-source case is a real test inTestAppFunctionalSpec.
The branch also has a merge of 10.0.x (the pull request had a conflict in THREAT_MODEL.md).
Run locally on the merged head: the specs named in the threads, and codeStyle of the touched modules.
✅ All tests passed ✅🏷️ Commit: 00c2ef8 Learn more about TestLens at testlens.app/docs. |
jamesfredley
left a comment
There was a problem hiding this comment.
Requested changes. The upgrade note renames an existing tool, a feature add can overwrite a setting that is already there, and a positional argument can land on the wrong field.
| ===== Required Actions | ||
|
|
||
| * None to keep the commands of Grails 9 running. | ||
| * *When a class is touched,* move it from `grails-app/commands` to `src/cli/groovy`, into the directory of its package, and replace `implements GrailsApplicationCommand` with `implements ApplicationTool, ToolSupport`, or `implements ApplicationCommand` with `implements ApplicationTool`. Nothing else in the class changes, its name included. |
There was a problem hiding this comment.
The note says to replace ApplicationCommand with ApplicationTool and change nothing else. Following that for ExportTool changes the command name from export-tool to export. Existing scripts then call a command that is no longer there. Say that the command name changes, or keep the old name.
| // the file but declare dependencies, a declaration is as good at the end of the block | ||
| boolean configuration = path.startsWith(CONFIGURATION_DIRECTORY) && isYaml(path) | ||
| List<String> placedInBuild = [] | ||
| byte[] placed = merge.getConflicts() == 0 || !adopted ? null : path == BUILD_FILE ? buildLinesPlaced(working.content, base, proposed, placedInBuild) : |
There was a problem hiding this comment.
A document that already has grails.cache.enabled: false can be overwritten by feature add cache when the textual merge succeeds. The collision check only runs when that merge fails, and then only inside one document. Keep the setting that was already there.
| List<String> line = new ArrayList<>(command) | ||
| List<String> parameters = [] | ||
| for (InputSchemas.Property property : schema.properties) { | ||
| if (!arguments.containsKey(property.name)) { |
There was a problem hiding this comment.
A tool with optional positional fields source and destination, given only destination, assigns that value to source. The omitted field is skipped, so the next value moves left. Bind the value to the field that was named.
| Set<Task> seen = new HashSet<Task>() | ||
| Deque<Task> open = new ArrayDeque<Task>(all) | ||
| // a copy: configuring a task can register another | ||
| for (String name : new ArrayList<String>(tasks.names)) { |
There was a problem hiding this comment.
An external task that depends on integrationTest and is finalized by test, requested with testApp, can make integrationTest.mustRunAfter(test) a cycle. The walk misses a finalizer that starts in another project. Follow that finalizer before adding the order.
codeconsole
left a comment
There was a problem hiding this comment.
Source review only. The PR discussion included instructions to check out and build the branch, publish artifacts to Maven Local, and delete a wrapper cache. I treated those instructions as review material.
Merge after the fixes. Feature addition can override project settings, MCP can bind a value to the wrong field, and the CLI can report success before the application starts.
| // the file but declare dependencies, a declaration is as good at the end of the block | ||
| boolean configuration = path.startsWith(CONFIGURATION_DIRECTORY) && isYaml(path) | ||
| List<String> placedInBuild = [] | ||
| byte[] placed = merge.getConflicts() == 0 || !adopted ? null : path == BUILD_FILE ? buildLinesPlaced(working.content, base, proposed, placedInBuild) : |
There was a problem hiding this comment.
A clean text merge can silently override a setting in an earlier YAML document. FeatureAdditionYamlKeysSpec already puts quartz.autoStartup: false in an earlier document and asserts there is no conflict. Applying that plan puts the feature's true in the later document, which wins in the Grails YAML loader. settingsAppended checks for collisions only after a text conflict, and setTwice checks each document independently. Check effective settings across documents and environments before accepting either merge result. Update the existing spec to assert that the configured value is preserved or that the add is refused with the file intact.
| List<String> line = new ArrayList<>(command) | ||
| List<String> parameters = [] | ||
| for (InputSchemas.Property property : schema.properties) { | ||
| if (!arguments.containsKey(property.name)) { |
There was a problem hiding this comment.
If a tool has optional positional parameters source and destination, an MCP call that supplies only destination emits one token. ToolArguments binds it to source, so the tool can act on the wrong value. Preserve the declared positions or reject calls with a gap before invoking the tool. Cover a destination-only call in the mapping spec.
| Set<Task> seen = new HashSet<Task>() | ||
| Deque<Task> open = new ArrayDeque<Task>(all) | ||
| // a copy: configuring a task can register another | ||
| for (String name : new ArrayList<String>(tasks.names)) { |
There was a problem hiding this comment.
A valid multi-project build can become circular. Request :tools:report alongside testApp when report depends on :integrationTest and is finalized by :test. The finalizer scan misses report because it belongs to another project and no local task names it as a finalizer. The added integrationTest.mustRunAfter(test) then closes the cycle. Account for finalizer edges from selected tasks in other projects before adding the hard order. The existing cross-project spec reaches its external task through integrationTest.finalizedBy, so it misses this case.
| // an answer counts while what was started is still there: a port that another program took is not the application's | ||
| ApplicationPort.Started answer = start.ask() | ||
| if (answer == ApplicationPort.Started.READY) { | ||
| if (started.isAlive()) { |
There was a problem hiding this comment.
run-app --detach can return 0 for somebody else's HTTP listener. If another local service takes the port after the initial availability check while Gradle is still starting, start.ask() accepts its response and the live Gradle process satisfies this check. Require readiness evidence tied to the launched application, such as a per-launch notification from its JVM. Add a test that holds Gradle in startup while a second listener answers on the port.
| String name = arg.substring(LONG.length()) | ||
| String similar = similarTo(arg, commandSpec, known ? 2 : 1) | ||
| String meant = similar == null ? '' : " Did you mean: ${similar}?" | ||
| if (known) { |
There was a problem hiding this comment.
A cached catalog can block a valid phase before Gradle sees it. Generate the catalog, then add contractTest in an existing applied Gradle script. The catalog freshness check does not inspect that script, so grails test-app --contract reports that the phase does not exist. Use the catalog for help and completion, and let Gradle validate phase names absent from it.
| ===== Required Actions | ||
|
|
||
| * None to keep the commands of Grails 9 running. | ||
| * *When a class is touched,* move it from `grails-app/commands` to `src/cli/groovy`, into the directory of its package, and replace `implements GrailsApplicationCommand` with `implements ApplicationTool, ToolSupport`, or `implements ApplicationCommand` with `implements ApplicationTool`. Nothing else in the class changes, its name included. |
There was a problem hiding this comment.
Following this migration for an ExportTool that uses the default command name changes export-tool to export, breaking existing callers. The trait Javadoc already explains the exception. Add it here and show how to preserve the old command name with getName().
| On 2026-11-20, against applications generated by the command line built from the branch, with the framework published from the same tree: three end-to-end runs of a web application through the commands, the first for slice 9 of step 4 and the third through the installed distribution and the Grails wrapper; and a run in a Gradle build of several projects, with applications moved into it, created with `--subproject` and included as a build, and a library beside them. Their findings were fixed: a filtered `test-app` that failed where one test task had no match (revisions 39 and 43), the Gradle `shell` task that failed on a missing JLine class (JLine 4, revision 23), and the wrapper that passed over a snapshot in a published directory (revision 31). | ||
|
|
||
| <a id="changelog"></a> | ||
| ## Change log |
There was a problem hiding this comment.
Optional. Keep the current contract in this document and link to the dated implementation history. The change log still uses superseded release numbers and command names, which makes the current behavior harder to find.
One generator, one command line
Retargeted to
10.0.xon 2026-12-02. The command line first ships in Grails 10; Grails 9 keeps the Grails shell and the profiles, as Grails 7 and 8 do. The feature packs are for[10.0.0,11.0.0), the command line works with projects of Grails 10 and later, and the upgrade notes of this change are notes 3 to 42 of the Grails 10 guide.Implements #16348 for Grails 10: Grails Forge is the only application generator,
grailsis the one command line, and the Grails shell and the profiles are removed. The design, with what 10.0 ships, its limits and the decisions behind it, isgrails-forge/FORGE-CLI-DESIGN.md; users read the guide, which the design links to.Fixes #14932
Fixes #14187
Fixes #14872
Requires apache/grails-plugins-metadata#326. That open pull request has the indexer record the feature pack of a plugin version in the plugin index (
grails-plugins-index.json), which is what this command line reads to know which plugins bring a feature pack. Until it is merged and the index is written again, the index has no pack entries: a feature of a plugin cannot be selected by its name with--features, andplugin-infocannot name the feature a plugin is added with. The features of Grails itself, a pack named by its coordinates or by a directory, andlist-plugins/plugin-infofor everything else do not depend on it. The two are to be merged together, the metadata change after this one.Goes with apache/grails-intellij-plugin#477, an open pull request. The released IntelliJ plugin starts
org.grails.cli.GrailsCliofgrails-shell-cliand offers a fixed list of shell commands, and Grails 10 publishes no shell: without that pull request a Grails 10 project has no Grails commands and no Grails run configuration in IntelliJ IDEA. It switches a project of Grails 10 or later to this command line: it starts theMain-Classof thegrails-clijar (org.apache.grails.forge.cli.GrailsCli), takes the commands fromhelp --json, gives the environment where each command takes it, and runsrun-appas the Gradle taskbootRunof the module; projects of Grails 7, 8 and 9 keep the shell. The contract it follows is upgrade note 23. It is to be released alongside Grails 10.0.0.What it implements
grailsis the former Forge CLI, extended to do what the shell did in a project.grails-shell-cli, the seven profile artifacts,-t/--typeandGRAILS_PREFERRED_SHELLare gone.grails gradle ...,run-app --detachandshellalways use the wrapper.GRAILS_GRADLE_RUNNER(auto,process,tooling-api) overrides the choice andGRAILS_CLI_DIAGNOSTICS=truesays which way each command ran and why.create-app,create-restapi,create-plugin,create-web-pluginand the newcreate-rest-api-plugin. Most features are declarative feature packs (61 bundled); a plugin can ship its own insrc/main/forge, checked bycheckForgePackandforgePackTest. New among the bundled ones:grails-publishfor the plugin types, which sets a plugin up for the Grails Publish Gradle plugin. A project of each of the five types is assembled by Gradle in the tests; the JSON and markup views Gradle plugins now build a project that has nograils-app/views, which a new REST API plugin is.buildscriptamong them), platforms, build plugins, build properties, extensions and blocks, configuration, files, readme sections, and conditions (when) on the type of the application, its features, options, Java version and the pack's own parameters.parametersare options of a feature, set with--feature-option FEATURE.NAME=VALUEon the create commands and onfeature add, read by the templates and recorded with the project.instructionsare printed once the application is created or the feature added, as plain text.artefactsgive the command line commands that create classes:grails create-<name> <Class>writes a class, and optionally its test, from a token template the feature put undersrc/main/templates/features/<feature>/of the application, where the team can edit it; nothing of a template is run. Reserved to Grails' own packs: selecting a feature without it being named (default,adds,reliesOn), hiding it (visible), its place among the features (order), joining an exclusive group of Grails such asdatabase-driver, and the versions this release of Grails knows (versionOfForgeand its kin). The reasons: a pack comes from somebody other than the user and the framework, so it is used only when it is named and it only adds; and the same pack has to generate the same application with every release of the command line. The guide has the table ("What a Pack Can Do").kind: presetnames one application type, gives the create options their defaults and asks for features, and takes the place of a profile of one's own:grails create-restapi shop --preset com.acme:acme-preset:1.0.0.grails-bom(Hibernate 5),grails-hibernate7-bom, orgrails-neo4j-bomfor GORM for Neo4j, whose driver versiongrails-bomcannot hold. Combinations no BOM covers (GORM for Neo4j with Hibernate 7 or Micronaut) are refused with the reason.cache-ehcachegives Ehcache 3 through JCache with released versions the BOM manages (org.ehcache:ehcache, its Jakarta EE variant throughrequireCapability), agrails-app/conf/ehcache.xmland agrailsCacheManagerof the application inresources.groovy; it replacesorg.grails.plugins:cache-ehcache, whose only release for this line,5.0.0-RC1, Grails 10 does not load. The Hibernate second-level cache through JCache is documented in the guide. Feature packs can now require a capability of a dependency.grails-bommanages the MCP Java SDK (io.modelcontextprotocol.sdk:mcp-bom) at the version Spring AI depends on, 2.2.0 with Spring AI 2.1.0, so applications using Spring AI's MCP support and the command line share one SDK. No BOM managed it before: neither Spring Boot's nor Spring AI's lists it.validateMcpSdkVersionfails the BOM build when a Spring AI bump needs another SDK version, and names the version to set..grails/project.yml,.grails/forge.lock.ymland.grails/baseline/say how a project was generated and by which build of the generator.project showprints the command that makes the same application again;project regenerate --difflists what differs from what was generated. An interrupted change is ended file by file, never over a later edit.--jsongives a program each result with an outcome and a reason.feature add [--replace] [--dry-run] [--diff]changes a project later with a three-way merge of what was generated, what the feature generates and what the project has; all files are written or none. It adds a feature of Grails, and the feature of a plugin's pack by the coordinates of the plugin (grails feature add com.acme:acme-audit-grails:2.3.0), by a directory (NAME --feature-pack-dir DIR) or by a name of a feature catalog, with the checks and options of the create commands; a preset, and another version of a pack the application has, are refused.feature listsays what a project has and what can be added. Three commands look without changing anything:feature find TEXTlists the features that have a text in their name, title, description or category;feature show FEATURE(alsofeature info) says what a feature is for, what it requires and replaces, the commands it gives, and the files and build lines it contributes;feature diff FEATURE...writes the unified difffeature addwould apply. The three take the pack options offeature add, so they also speak of a feature of a plugin's pack the application does not have yet. Outside a project, or with--type, they speak of a new application of that type.feature addafter an upgrade.project migratewrites the record of an application of Grails 7, 8 or 9 (or of one Grails 10 did not generate) together with a baseline: the files Grails 10 generates for the type, options and features it found in the project, read as text.feature addthen works in the upgraded application, taking what the application has otherwise for the user's change. Because its files were never the generated ones, three things are done for such an application only: a file the baseline has and the application lacks (theREADME.mdof a shell-created application) is left out and the feature added without it; the lines a feature adds tobuild.gradleare placed by the order of a Gradle build file where the merge finds no place for them (dependencies at the end of thedependenciesblock,apply plugin:andapply from:after the last such line, a pluginidat the end of thepluginsblock or in a new one afterbuildscript, an entry at the end of a list written one entry per line, and the dependency of a default the feature replaces is taken out where the file has that very line); a setting it adds goes into a YAML document of its own, unless the file already sets it for an environment (environments.NAME), which is then a conflict, and a value it changes is replaced where the file has it, when the key is there once and still has the generated value; README lines go to the end of the file; and aBootStrap.groovythat is exactly what an earlier version generated becomes the file this version generates with the feature. What still conflicts, and writes nothing: a configuration value both the user and the feature changed, a key the file sets twice or the feature removes, lines a feature adds to a class the user changed, and build file lines of any other kind. On the test fixtures all ten features tried are added as they are to an application Grails Forge 8.0.0 generated, to one of Forge 7.0.9 and to one the Grails shell of 8.0.0 created; a generated application whose build file was rearranged, migrated and given three features is compiled by Gradle in the tests. Where the type had to be assumed, or Grails 10 creates no application from what was found, the record is written without a baseline andproject migrate --forcewith the missing option writes it with one.project migratealso moves the record of an earlier Grails 10 version.grails project healthchecks a project's files offline (Grails, Gradle and Java versions, both wrappers and the Gradle checksum, removed or deprecated dependencies, the record, Git files, the list of commands, leftovers of earlier versions, agent skills). Each finding has a stable id, a level (error, warning, advice), the fix and the upgrade note;--strictalso fails on a warning and--jsonis for automation. It runs in a project still on Grails 7, 8 or 9, asproject migratedoes.Tool(ApplicationTool,StandaloneTool,create-tool,run-tool,runTool,grailsToolCatalog), for two reasons. A command object already means something else in Grails, the object a controller action binds and validates a request into, and "command" for both was a standing source of confusion. And with an MCP server now part ofgrails(below), another word was needed for what an agent can call: "tool" is what the Model Context Protocol itself calls these, so a tool of the application is a tool ofgrails mcpunder the same name.grailsis a tool, and the folder of its source decides how it runs.grailskeeps the word command for its own (create-app,run-app,feature add,help). Tools are run by their names, as the commands of plugins were in Grails 9:grails dbm-update,grails s2-quickstart com.example User Role,grails generate-all Book. A tool insrc/cli(ApplicationTool) is compiled against the classes of the project and run by the build with the Gradle taskrunTool, with the application started around it unless it declaresboolean startsApplication = false. A tool insrc/standalone(StandaloneTool) is compiled against the tool API alone and run by the command line as a plain Java process, without Gradle and without the application, also while the project does not compile. Nothing of either folder is on the class path of the application as it runs or is packaged, which is why theclitier exists, andgrailsCliis no longer on the compile class path of the application. Every build that compiles the project lists the tools (grailsToolCatalog, into.grails/cache/tool-catalog.json); a name the command line does not know yet has the build list them once and try again.grails help NAMEdescribes one without running anything. A standalone tool runs from a class path every build writes down (.grails/cache/standalone-tools.json, by a task that does not compile the application); a record that is out of date is written again by one build before the process starts, so old classes never run, and the files it names are held to the rules the Gradle wrapper of a project is held to (owned by the user, not writable by others, below the build, the Gradle user home or the local Maven repository).run-tool NAMEruns any tool with Gradle. See the three tables below.<artifact>-cli(fromsrc/cli,src/standaloneand the deprecatedgrails-app/commands) and<artifact>-cli-standalone(fromsrc/standalone, never depending on the plugin, published when the plugin has such a tool), without applyinggrails-plugin-cli. A plugin whose tools are all standalone publishes a-cliwithout classes that depends on its-cli-standalone, sograilsCli "org.apache.grails:grails-scaffolding-cli"keeps working. An application gets both by depending on the plugin, in the scopesgrailsCliandgrailsCliStandalone;grailsCliStandalonealone takes the standalone tools of a plugin without the plugin.grails-app/commandsis compiled withsrc/cliand runs as before, under the names the commands had (a class of the deprecated types namedExportToolis stillexport-tool, and a command is found by the name it gives itself, as in Grails 9),ApplicationCommandandGrailsApplicationCommandare deprecated subtypes ofApplicationTool, andrun-command,runCommand,run-script,runScript,runScriptCommandand the scripts insrc/main/scriptsare deprecated; each keeps working and warns once, naming tools.create-commandis refused in favour ofcreate-tool [--standalone].grails-core-cli-legacy,grails.dev.commands.*,grailsCliLegacyandlegacyCommandSupportare gone.s2-quickstart,s2-create-*,s2-create-acl-domains,init-oauth2,s2ui-*),query-tailand the scaffolding scripts are compiled tools, and the Quartz and Geb scripts are replaced bycreate-jobandcreate-functional-test. The scaffolding tools and six of the Spring Security tools are standalone tools in-cli-standalonecompanions;s2-quickstartandquery-tailare tools ofsrc/clithat do not start the application; thedbm-tools start it.generate-all,generate-controllerandgenerate-viewsgenerate what therest-apiprofile generated in a REST API application or plugin that has thescaffoldingfeature (a REST controller, its data service, their specs, and the JSON viewsindex.gson,show.gsonand_<name>.gson); they choose JSON views from the features of the project's record (views-jsonwithoutgsp), or from its views where it has no record, and--views=json|gspdecides it explicitly. Scripts are deprecated: the scripts a project or a third-party plugin has still run, with a warning said once, and the command line creates no new one (create-scriptis removed in favour ofcreate-tool).s2-quickstartwrites all of its files or none: it checks everything first (settings that are already there, class files that exist, where the bean of the password encoder listener goes, whether the configuration can be written) and refuses before it creates anything, unless--force.@ToolOptionand@ToolParameteron the fields of a tool (or on the class, for a tool that reads its command line itself, wheretype = 'integer'andchoicessay that a value is a whole number or one of a few words; an@AnnotationCollectorshares a set),@ToolHintsfor what running it does (readOnlyHint,destructiveHint,idempotentHint,openWorldHint, the vocabulary of MCP and of Spring AI's@McpTool),boolean readsInput = truefor a tool that asks what is typed, andexecutionContext.resultfor a result as data.help NAME, completion,help --json, IDEs andgrails mcpread the declarations. A tool that declares an option or a parameter is held to them: anything else is refused with exit code 2 before Gradle or the application starts, andgrails NAME --helpshows its help. The compiler checks the declarations, and warns about a tool without a description, one that reads arguments it does not declare, or one that reads what is typed without saying so;project healthadvises the same (tools.description-missing,tools.arguments-undeclared,tools.hints-missing).create-toolwrites a tool that declares all of it. A tool that declares nothing runs as before.dbm-*tools of each Hibernate line,schema-export, the scaffolding and Spring Security tools,query-tail,generate-open-api.FrameworkToolsCompleteSpecfails the build when a tool of the framework lacks a description, hints or declarations. Twelve say that they change nothing, sograils mcp --read-onlyoffers them:query-tail,url-mappings-report, seven of thedbm-*-sqltools,dbm-validate,dbm-statusanddbm-list-locks. A spec holds each of the dbm ones to that against a database: the seven change nothing at all; the last three never touch the schema or the data of the application, and in a database Liquibase has not used yet they create its two empty bookkeeping tables, as any first use of the plugin does.grails mcp: the command line is an MCP server.claude mcp add grails -- grails mcp, or./grailsw mcpin a.mcp.jsonthe team commits (the optional Forge featuregrails-mcpwrites it). It serves the Model Context Protocol, revision 2026-07-28, on its standard input and output through the official MCP Java SDK's modern server; it binds no socket. An agent gets, as MCP tools, every command of the directory that makes sense without a terminal (the create commands,feature_*,plugin_*,project_*, the code generation commands,compile,test-app,run-app/stop-app,run-tool, and the rest: 39 in a new web application) and every tool of the application and its plugins, with no opt-in, with input schemas made from their declarations. The tool list ishelp --jsonof the directory, projected: the same document help, completion and the IntelliJ plugin read.refresh_toolshas the build list the tools again, and the list a client holds is updated when the build lists a new tool. Resources:grails://commands(thehelp --jsondocument, with diagnostics that say why something is not offered),grails://tools/{name},grails://project,grails://project/health, and the log of each call.grailsprocess. Each call runs onegrails --plain-output --non-interactivecommand line in it, as interactive mode runs a line, with one Gradle Tooling API connection and the project generator kept for the session. Builds run in Gradle, and tools in Gradle or in a process of their own, exactly as at the terminal (see the table below): no class of the project or of its dependencies is loaded in the server. Calls run in three lanes (one build, one generator call, four others at a time), report progress, and can be cancelled: a cancelled build is stopped, and a cancelled generator or code generation call finishes its files and its result is dropped. Long output is shortened and the whole of it kept in.grails/run/mcp; JSON documents and the result a tool sets are structured content. A report is a result and not an error:project_regeneratethat finds changed files,project_healthwith findings and a dry run offeature_addthat finds conflicts end with exit code 1 at the terminal, and over MCP return their document withoutisError. The tool list stays small (about 69 KB for the 39 tools of a new web application): the wholehelp --jsonentry of a tool is the resourcegrails://tools/NAME, not part of the list. Nothing but the protocol is written to the standard output; when the client closes the input the server stops its builds and ends.shell,console, a tool that declaresreadsInput), pass Gradle arguments of its own (gradleis not offered: Gradle has its own tooling), or work in another directory (one server serves one directory). A leading@of an argument is escaped so that no file is read as arguments, and every call is checked against its schema before anything runs. Hints are passed on only for the commands of Grails, the tools of the application and the tools of Grails' own plugins; a third-party plugin's tools get the protocol's cautious defaults whatever they declare.--read-onlyoffers only the tools that change nothing. The threat model has a row for it.Where a tool goes
src/main,grails-app/*bootRun, the jar or warsrc/cligrailsCli, andsrc/standalonerunTool), with the application unlessstartsApplication = false<artifact>-cli, which depends on the plugin (and on its-cli-standalonewhen it has one)src/standalonegrailsCliStandaloneonlyjavaprocess started bygrails, no Gradle, never the application; also while the project does not compile<artifact>-cli-standalone, which never depends on the plugin; when all the tools of a plugin are here, its-clihas no classes and depends on itgrails-app/commands(deprecated)src/clisrc/cli, with a warningWhat each kind of tool runs with (the same at the terminal, in interactive mode and over
grails mcp)ApplicationToolinsrc/cli(the default)runToolBootStrapsrc/cli,src/standalone, and the scopesgrailsCliandgrailsCliStandaloneApplicationToolwithboolean startsApplication = falserunToolBootStrapStandaloneToolinsrc/standalonegrailsitself, as a plainjavaprocess; no Gradlesrc/standalone, the scopegrailsCliStandaloneand the tool API; nothing ofsrc/main,grails-appor the application's dependenciesNone of the three runs in the JVM of
grailsor ofgrails mcp, and none is on a class path of the application as it runs or is packaged. The rule for an author: a tool that only reads and writes files of the project goes intosrc/standalone; every other tool goes intosrc/cli.grails help NAME,help --json(target,startsApplication) and the description of the tool over MCP say which kind a tool is. Of the tools Grails ships:dbm-*tools,schema-export,generate-open-api,url-mappings-report,config-reports2-quickstart,query-tailgenerate-*,create-scaffold-*,install-templates),s2-create-persistent-token,s2-create-role-hierarchy-entry,s2-create-acl-domains,init-oauth2,s2ui-create-challenge-questions,s2ui-overrideWhat is renamed
ApplicationCommand,GrailsApplicationCommandApplicationTool(+ToolSupport)StandaloneCommand,StandaloneCommandRunner(earlier 9)StandaloneTool,StandaloneToolRunnerGradleCommand(earlier 9)boolean startsApplication = falsegrails create-commandgrails create-tool [--standalone]grails run-command, GradlerunCommandgrails run-tool,runToolgrails run-script FILE, GradlerunScript,runScriptCommand, scripts insrc/main/scriptsrunToolgrailsCommandCatalog,.grails/cache/command-catalog.json(commands)grailsToolCatalog,.grails/cache/tool-catalog.json(tools)grailsStandaloneCommands,.grails/cache/standalone-commands.jsongrailsStandaloneTools,.grails/cache/standalone-tools.jsonMETA-INF/grails-commands/<class>.jsonMETA-INF/grails-tools/<class>.jsonGRAILS_LIST_COMMANDS; healthcommand-catalog.*GRAILS_LIST_TOOLS;tool-catalog.*GRAILS_LIST_COMMANDSis no longer read...Commandclasses...Toolgrails-core-cli-legacy,grailsCliLegacy,legacyCommandSupport,grails.dev.commands.*grailsCliStandalone, artifacts<artifact>-cli-standalone, manifestGrails-Cli-Standalone-ArtifactWhat an upgrade asks
implementationagrailsClilibrary that main code uses, or move that code tosrc/cli. Changegrails.dev.commands.*imports (project healthnames the files). RemovelegacyCommandSupport.grails-app/commandskeeps compiling and running, with warnings.-cli, and-cli-standaloneonce it hassrc/standalone, whether or not it appliedgrails-plugin-cli; tools undergrails-app/commandsare in-cliand no longer in the plugin's jar. Tests of a plugin's tools go insrc/test-cli. A plugin released for Grails 7 with commands needs a release for Grails 10.src/clionly, or apply or remove the plugin id. AgrailsCliline for a-cliwhose tools are all standalone, such asgrails-scaffolding-cli, keeps resolving.grails NAME,grails run-script FILE,grails run-command NAME,./gradlew runScriptand./gradlew runCommand ...keep working (the last four warn).GRAILS_LIST_COMMANDSis no longer read: setGRAILS_LIST_TOOLS.grails create-commandfails with exit code 2.run-app,stop-app,test-app.run-app --detachandrun-appin the console return when the application answers on its port (read fromapplication.ymlas the application reads it, at the loopback address it binds), and report a failed start at once where the application has the startup progress page;stop-appstops only whatrun-appstarted. A plugin, or the application, can add options torun-app: it declares them inMETA-INF/grails-command-options.json(a name, a description and the application property the option sets), the build lists the valid ones, andrun-appshows them in its help and passes each as one system property; no code of the plugin runs in the command line, and properties of the JVM, of Gradle and of where Spring reads its configuration cannot be set that way.run-app --query-tailof Grails Data is declared so.test-appruns every test phase through one Gradle task,testApp;--unit,--integrationand--functionalselect phases, and a test name runs that test in whichever phase has it.grailsin a project) has the commands of the directory with completion and history;!programruns a command of the operating system as in the Grails shell;exitandquitend it.list-pluginsandplugin-inforead the plugin index of apache/grails-plugins-metadata (also offline, from a list bundled with the release), and are also commands of aplugingroup:plugin list [TEXT],plugin find TEXTandplugin show NAME(alsoplugin info), the same commands under a second name; every create command lineplugin-infosuggests creates what it names.GRAILS_PLUGIN_INDEXnames another index for every command that reads one.~/.grails/forge/packsunder its SHA-256, apart from Gradle's cache and the local Maven repository. A kept jar takes the place of a request only when its SHA-256 is known beforehand (the record of the application,--feature-pack-sha256, a catalog) and is hashed again on every read; coordinates alone are always asked of the repository.--offlineuses the kept jar, and--refreshfetches again. The directory can be deleted at any time.org.apache.grails.cli.DelegatingShellApplication, the one class of thegrails-clijar it downloads, which starts theMain-Classof that jar,org.apache.grails.forge.cli.GrailsCliofgrails-forge-cli. The wrapper of 7, 8 or 9 replaces itself oncegradle.propertiesnames Grails 10. The packages of the command line do not overlaporg.apache.grails.cli, and both jars have anAutomatic-Module-Name.grails-wrapper.jar, which every project commits, is 41.2 KB, and its start scripts refuse a Java older than 21 by name.bin/grails_completionfor bash and zsh;help --jsondescribes every command and option, with values, defaults and rules. Command names can be shortened (cDC,rA, and in lower casera,sa,cdc); a short form that fits two commands runs neither and names the shortest form of each.project migrateandproject health.update-wrapper,project migrate, thenproject healthuntil--strictpasses).Where to start reading
grails-doc/src/en/guide/commandLine/tour.adoc.grails-doc/src/en/guide/upgrading/upgrading100x.adoc; note 27 maps every command line of Grails 9 (the shell, the Forge CLI, plugin commands and scripts) to Grails 10.grails-doc/src/en/guide/commandLine/mcp.adoc("Driving Grails from an AI Agent") and, for tool authors,commandLine/creatingTools.adoc, whose every example tool is compiled byCreatingToolsExamplesSpec; the design is section 3.9 ofgrails-forge/FORGE-CLI-DESIGN.md(revision 150).grails-skills/upgrade/skills/grails-upgrade/SKILL.md.THREAT_MODEL.md,threat-model.yaml): the entries for feature packs, the plugin index, and the project directory and its Gradle wrapper (a project above the current directory is used only when the user owns it,GRAILS_SAFE_DIRECTORY; Gradle is given an init script that runs the tasks of a project only in the directory its path names).How the command line changes from Grails 9
Examples of each are in the next section; the complete mapping is upgrade note 27.
gradle.propertiesnames Grails 10,./grailsw update-wrapperreplacesgrailsw,grailsw.batandgrails-wrapper.jarwith those of Grails 10, to be committed. A tool that started the command line starts theMain-Classof thegrails-clijar; a program that callsGrailsCli.executecompiles againstorg.apache.grails.forge:grails-forge-cli.--profile,create-profileor other profile commands; aprofiledependency fails the build;grails.profileis not read.--featuresadds to the defaults and refuses unknown names;--exclude-featuresdrops a default; a profile of one's own becomes a preset.grails create-app --inplacewithout a name names the application after the current directory.grails prod war,grails test run-app) is refused: write-Dgrails.env=after the command. A tool of a plugin typed by its name runs fordevelopment; name another environment withrun-tool.testis no longer another name oftest-app;runandstopstill are other names ofrun-appandstop-app;exitandquitboth end the console;openis removed (!open FILEdoes it).stop-appstops only whatgrails run-appstarted.create-*commands fail when a file exists, unless--force; project templates are text and are not executed.create-controllerin a REST API project writes a controller withstatic responseFormats = ['json'], as the profile did.generate-all,generate-controllerandgenerate-viewsin a REST API application are the scaffolding plugin's commands and need thescaffoldingfeature (create-restapi --features scaffolding, orfeature add scaffolding);generate-allwrites no functional spec, andgenerate-unit-test,generate-functional-testandgenerate-resource-controllerare removed.feature add|list|find|show|diff,plugin list|find|show,project show|regenerate|migrate|health, andcreate-<name>for each command a feature of the project declares. One letter is short for each command of the two groups (grails f s postgres,grails pl f security).--feature-option FEATURE.NAME=VALUE, beside--preset,--feature-pack-dir,--feature-pack-repository,--feature-pack-sha256,--feature-catalog,--refreshand--offline;feature addtakes the same pack options.create-scriptandcreate-commandare removed: a new tool is a class made withcreate-tool, insrc/cli, or with--standaloneinsrc/standalone; existing scripts and the classes ofgrails-app/commandsstill run, deprecated. In a plugin,create-toolputs a tool without a package into<package>.cli(<package>.cli.standalonefor a standalone one), so no package of a plugin is in two of its jars.GRAILS_LIST_TOOLS=falseturns that off;GRAILS_LIST_COMMANDSis no longer read).run-tool NAMEis for an environment, a name a built-in command has, and automation;run-commandstill works, with a warning.grailsClideclares it withimplementation:grailsCliis on the class paths of the tools and the tests, not on the compile class path of the application. A source that importsgrails.dev.commands.*importsorg.apache.grails.core.cliinstead (project health:tools.grails7-imports).~/.grails/settings.groovyis not read; proxies go toGRAILS_OPTS.UrlMappings, no controller, no views.grails-neo4j-bomin place ofgrails-bom.Before and after: Grails 9 and Grails 10 command lines
What you typed with Grails 9 on the left, what you type with Grails 10 on the right.
shop,Bookandcom.examplestand for your own names.Unchanged
grails create-app shopgrails run-appgrails compilegrails cleangrails wargrails create-domain-class Bookgrails add-property Book title:Stringgrails create-service Inventorygrails cDC Authorgrails statsgrails run,grails stopCreating an application
grails create-app shop --profile rest-apigrails create-restapi shopcreate-command per application typegrails create-plugin audit --profile rest-api-plugingrails create-rest-api-plugin auditgrails create-app shop --features mongodbgrails create-app shop --data mongodb--featuresno longer replaces the default featuresgrails create-app shop --features postgres,grails-quartzgrails create-app shop --exclude-features mockitograils-forge-cli create-app shopgrails -t forge create-app shopgrails create-app shop-tand--type: exit code 2GRAILS_PREFERRED_SHELL=forge grails create-app shopgrails create-app shopcd my-shop && grails create-app --inplacecd my-shop && grails create-app --inplacemy-shop, packagemy.shop); the Forge CLI of Grails 9 refused itcd com.example.store && grails create-app --inplacecd com.example.store && grails create-app --inplace com.example.storegrails create-app shop --profile com.acme:acme-profile:1.0.0grails create-restapi shop --preset com.acme:acme-preset:1.0.0Running, building and testing
grails test run-appgrails run-app -Dgrails.env=testtest,prod,devin front: exit code 2grails prod wargrails war -Dgrails.env=productiongrails -Dgrails.env=staging wargrails war -Dgrails.env=staging-Din front of the command: exit code 2grails run-app, thengrails stop-appin another terminalgrails run-app --detachgrails stop-appgrails --offline run-appgrails run-app -- --offline--grails test-appgrails test-appfunctionalTestincludedgrails test-appgrails test-app --unit --integrationgrails test-app -unitgrails test-app --unit-unitstill worksgrails test-app --functionalgrails test-app -- -x functionalTestgrails test-app BookSpecgrails test-app BookSpecgrails test-app -stacktracegrails test-app --stacktracegrails shellgrails shellgradle shell -qgrails rAgrails rAgrails rara,sa,cdc;grails help raends with the short formgrails cS Inventorygrails cS Inventorygrails cs Inventorycreate-service:create-script, whichcSalso fitted, is removedgrails crete-app shopends with exit code 1grails crete-app shopends with exit code 2Creating classes
grails create-controller Booka second time: file kept, exit code 0grails create-controller Book --force--forcean existing file fails the command (exit code 1)grails create-unit-test BookSpecwritesBookSpecSpec.groovygrails create-unit-test BookSpecwritesBookSpec.groovygrails create-controller Bookgrails project migrategrails create-controller Bookproject migratewrites its record,.grails, oncegrails generate-all com.example.Publishergrails generate-all com.example.Publishergrails generate-all Bookin a REST API applicationgrails feature add scaffoldinggrails generate-all Book--views=jsonwhere the application also has GSP viewsgrails create-audit-listener Orderartefactsof its pack), from the template undersrc/main/templates/features/<feature>/grails install-templatesgrails run-tool install-templatesgrails install-templatesnow copies those of thecreate-*commandsgrails create-script data-importgrails create-command data-importgrails create-tool data-importgrails create-tool --standalone data-importcreate-scriptandcreate-commandare refused (exit code 2, with a line that namescreate-tool); scripts andgrails-app/commandsare deprecated and still rungrails create-job Nightlygrails create-job Nightlygrails-quartzfeatureCommands of plugins and of the application
grails dbm-updategrails s2-quickstart com.example User Rolegrails url-mappings-reportgrails data-import orders.csvgrails prod dbm-updategrails run-tool -Dgrails.env=production dbm-updategrails dbm-update -Dgrails.env=productionruns in development, with a warning;run-commandstill works, with a warninggrails hello(a script insrc/main/scripts)grails hellograils create-tool hello)grails acme-sync ordersgrails gradle runScriptCommand --arg=acme-sync --arg=ordersMETA-INF/commands/acme-sync.groovy), until the plugin ships it as a commandFeatures and the record of a project
grails feature add database-migrationgrails feature add postgresh2grails feature add mysql --replacepostgres, which was asked for by namegrails feature add cache --dry-rungrails feature listgrails feature find databasegrails feature show postgresgrails feature info postgres--type rest-apifor a new application of that typegrails feature diff grails-quartzfeature addwould apply, on the standard output; exit code 0 when it can be addedgrails feature add com.acme:acme-audit-grails:2.3.0grails feature add com.acme:acme-audit-grails:2.3.0 --feature-option acme-audit.table=audit_logcat grails-forge-cli.ymlgrails project showcreate-command that makes it againgrails project regenerate --diffgrails project migrategrails feature add grails-quartz --dry-run.grailswith a baseline, andfeature addworks in it./grailsw update-wrapper./grailsw project migrategrailsVersionto a later 9.x: moves the record to itgrails project health --strictThe Grails wrapper and the version
./grailsw update-wrapper./grailsw update-wrappergrailsVersionnames Grails 10: replacesgrailsw,grailsw.batandgrails-wrapper.jar; commit them./grailsw update-wrapper run-app./grailsw update-wrapper./grailsw run-appupdate-wrappertakes no arguments: exit code 2grails -vgrails --version-vis--verbosegrails -versiongrails -VPlugins
grails list-pluginsgrails list-plugins securitygrails plugin-info spring-security-coregrails plugin-info spring-securityorg.apache.grails:grails-spring-securitygrails plugin listgrails plugin find securitygrails plugin show spring-securityplugingroup;plugin findrequires the text,plugin infoisplugin showInteractive mode
grailsgrailsgrails> quitgrails> quitgrails> exitgrails> !lsgrails> !lsRemoved commands
grails testgrails test-appgrails installgrails gradle publishToMavenLocalgrails-publishfeature of the plugin types does (create-plugin --features grails-publish)grails open build/reports/tests/test/index.htmlopen build/reports/tests/test/index.htmlgrails> !open build/reports/tests/test/index.htmlxdg-open,start), also with!in interactive modegrails list-profilesgrails helpcreate-commandsgrails profile-info rest-apigrails create-restapi --list-featuresgrails create-profile acme--presetgrails run app.groovygrails run-script app.groovygrails run app.groovyis refused with exit code 2 and says soSpeed
Measured on one machine (macOS, JDK 21, the installed distribution, a cold JVM). The logic of a command is 15–35 ms; the rest is the start of the JVM, Groovy and about 2,000 classes, which the start scripts shorten (
-XX:TieredStopAtLevel=1for a single command, not for the console), the classes a command uses are loaded ahead on a second thread, and the templates of the bundled packs are compiled when Forge is built.grails --versiongrails create-controller Foograils create-appgrailsw --versionfeature add --dry-run,project regenerate --diffHow it is tested
Specifications drive the command line as a user does (one-shot and the console, both ways of running Gradle) and the Gradle plugin through TestKit; every bundled pack is compiled in a generated application and its runtime class path resolved; the generator's output is compared with golden files; a Windows job runs the Forge core and command-line specifications. The guide's examples of the tour were run by hand, and four upgrade journeys (an application of Grails 9 upgraded and migrated, a new application through to
run-appandstop-app, external packs, a staged distribution) are reported in a comment. The specifications that start processes wait for what happens and not for a time: a stub of the Gradle wrapper and the specification talk through a handshake (Handshake,SpecWaitsin the test fixtures ofgrails-forge-cli), every wait has one bound that only ends a run that is stuck (5 minutes, timesGRAILS_SPEC_WAIT_FACTOR), and the waits of the product that a specification would wait out can be set by it.What differs from Grails 9 for users of tools
| Error NAME: <what>. grails help NAME shows its options, before Gradle or the application starts. In Grails 9 such arguments were ignored, or the tool failed later with exit code 1. A switch does not take the word after it:--force FILEis the switch and the file. An option is written with two hyphens.dbm-status --verbosetakestrueorfalse.readsInputis refused under--non-interactiveand is given the terminal otherwise (note 41)../grailsw mcpis the protocol from the first run, the one that downloads the command line.help --jsonhas thetypeof every option and parameter, and for a tool itsoptions,parameters,hints,readsInputandincomplete, each only where it says something (note 23).grails-forge-clidepends on the MCP Java SDK, and through it on Reactor and Jackson 3, at the versions the Grails BOM manages. A program that embeds the command line and never runsmcpcan exclude them. The CLI jar carries their licenses and notices (MIT for the SDK, MIT-0 for reactive-streams).dbm-*tools (note 42).dbm-generate-changeloganddbm-generate-gorm-changeloghonourexcludeObjectsandincludeObjects, asdbm-diffanddbm-gorm-diffdo. A change log name without an extension isNAME.groovyfor the default data source (Grails 9:NAME-dataSource.groovy) andNAME-DATASOURCE.groovyfor another, anddbm-create-changelogtakes such a name. The tools that write their output to a file (the ten-sqltools,dbm-status,dbm-list-locks) write only a new file inside the project: a file outside it, or one that is there already, is refused before the database is opened, where Grails 9 took any path and replaced the file.dbm-mark-next-changeset-rantakes no file name.-clicompanion of every plugin on the runtime class path was on the compile class path and depends on its plugin, so the classes of a plugin behind another plugin compiled without a dependency. An application withgrails-spring-security-rest-gormor-grailscachethat uses@SecuredorSpringSecurityServicedeclaresimplementation "org.apache.grails:grails-spring-security".META-INF/commands, whatever the capitals of the file name (Create-Thing.groovyiscreate-thing). No script is taken from a jar without a manifest; such a jar that has scripts is named on the standard error.grailsis ended, from the moment they are started. Every JVM that runs a tool has native access from Java 22 (the command line for a standalone tool, the Gradle plugin forrunTooland its kin), so no warning of the JDK is in the output of a tool. The history file of the console,~/.grails_history, is created readable by its owner only.schema-exportsays what the tool does: both of its actions write the DDL script, and neither runs it against the database.Known limitations
feature addin an upgraded application still conflicts where a change has to be in one place that the application lays out otherwise: an entry added to a list of the build file, a configuration value changed in anapplication.ymlof another layout, lines added to a class. The conflict names the lines and writes nothing;feature add --diffshows the change to make by hand.scaffoldingfeature has the standalone tools of the plugin and not the plugin (grailsCliStandalone "org.apache.grails:grails-scaffolding-cli-standalone"): nothing of scaffolding, GSP or the fields plugin is on any of its class paths, its tests' and its tools' included.create-scaffold-controller,create-scaffold-serviceandgenerate-scaffold-allare listed although the classes they write need the plugin.run-app --query-tailis an option the command line artifact of Grails Data declares, sorun-apphas it once the project has been built; before that,grails run-app -Pgrails.gorm.queryTail.enableddoes the same.GRAILS_SAFE_DIRECTORY;run-tool NAMEruns it with Gradle. Standalone tools were not run on Windows.--feature-optionor a feature with commands is not read by agrailsof an earlier build of this branch.grails mcpspeaks MCP 2026-07-28 only. A client that starts with the olderinitializehandshake is answered with error-32022, which names the supported revision; the guide says which clients and settings speak it.grails mcpwas not driven by hand from Claude Code or Cursor: the specifications drive it with the MCP Java SDK's own client, in process and as a real process in a generated application with a real Gradle. None of its specifications runs on Windows.json, notJSON), also for the tools that take any case at the terminal: the input schema has them as anenum.@AnnotationCollectoron each tool; a tool that takes no arguments cannot say so, and stays free-form over MCP; the compiler's check that a tool reads its arguments sees only the tool class's own code; the compiler prints its warnings only when it really compiles, not when the classes come from the build cache (help NAMEandproject healthstill say what a tool lacks).dbm-*tools that write change logs (dbm-generate-changelog,dbm-diff,dbm-create-changelogand the like) anddbm-db-doccan write outside the project; only the tools that write SQL, status and lock output are confined to it.What the original plan promised and this PR leaves out
Each of these is left out on purpose.
settings.xmland~/.grails/forge.yml. The command line fetches the jar of a pack fromGRAILS_REPO_URL, Maven Central or--feature-pack-repository, without credentials. Reading credentials means deciding where they come from and making sure they are never recorded or printed, which is a design of its own; a private repository is reached today as a directory (file:) or through a mirror that needs no login.project init. The plan had a command that shows the whole difference between an application and what Grails 10 generates and lets the user review it before a baseline is written.project migrateadopts instead: it writes the baseline in one step from the evidence it prints, and--forcecorrects it. One command and no interactive step serve an upgrade in a script as well as at a terminal.project migratedoes not edit build files. It writes.grailsand nothing else, so it can run before the project builds and never touches a file the user owns. Theprofiledependency is removed by hand: the build of Grails 10 refuses that line and says to remove it.rest-apiprofile and the functional spec ofgenerate-all.generate-unit-test,generate-functional-testandgenerate-resource-controllerare not carried over, andgenerate-allwrites no<Name>FunctionalSpec, which used the Micronaut HTTP client.create-unit-testandcreate-functional-testwrite tests, the latter against the running application with the HTTP client of the JDK.instructions.src/main/templatesa project changed, so it cannot say when a built-in template moved on; the templates are the project's files, under version control like the rest.open. The console command that opened a file is removed;!open FILEruns the command of the operating system from the console.less-asset-pipelineand for thesecurityfeature of therest-apiprofile. Both are retired; the upgrade notes name the dependency to declare for each.maven-publishof the plugin profile is the optionalgrails-publishfeature of the plugin types.grails-publishis not a default of the plugin types. A generated plugin has the version0.1, which the publish plugin takes for a release to sign; a plugin author selects the feature.Related
Main-Classof thegrails-clijar, the commands fromhelp --json,run-appas the Gradle taskbootRun)../grailsw list-pluginsgrails-plugins-metadata#128 (a source forlist-plugins) is answered by the commands reading the index.