grails-gradle-plugin-archived
grails-gradle-plugin-archived copied to clipboard
Grails args aren't being honored by grails launcher
Setting grails args using -Pargs="
gradle -Pargs="--verbose --stacktrace" grails-run-app
The preceding command fails when the app hits an OutOfMemoryError, yielding following log lines:
| Error PermGen space (NOTE: Stack trace has been filtered. Use --verbose to see entire trace.)
java.lang.OutOfMemoryError: PermGen space
| Error Server failed to start: java.lang.OutOfMemoryError: PermGen space
I would have expected the --verbose
arg to have been passed through to the grails command, but it is not.
The fault for this appears to be in the GrailsScriptRunner; the GrailsLauncher is calling this executeCommand
:
public int executeCommand(String scriptName, String args) {
return executeCommand(scriptName, args, null);
}
Normally, the GrailsScriptRunner's main()
method is invoked, which sets up the CommandLine instance differently- namely, it calls the private processArgumentsAndReturnScriptName()
method, which is what processes the 'verbose' and 'stacktrace' command line arguments. This is not called from the executeCommand
method invoked by the launcher, which is why those two arguments are not being set properly. We could work around this by processing these arguments manually on the GrailsConsole instance, though the GrailsScriptLoader should also be fixed so this is unnecessary.
I have also created an issue on the Grails Jira for this problem.
This needs to be fixed in Grails for sure, but we can workaround this in Grails launcher for existing Grails version. See the workaround for interactive mode in DelegatingGrailsLaunchContext.
It's been almost a year with no activity. Is it difficult to add the work-around to grails-launcher?