grails-gradle-plugin-archived icon indicating copy to clipboard operation
grails-gradle-plugin-archived copied to clipboard

Grails args aren't being honored by grails launcher

Open ellerycrane opened this issue 12 years ago • 4 comments

Setting grails args using -Pargs="" or setting the args property explicitly in your GrailsTask configuration does not seem to carry over to the grails launcher. For instance:

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.

ellerycrane avatar Nov 23 '12 20:11 ellerycrane

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.

ellerycrane avatar Nov 24 '12 04:11 ellerycrane

I have also created an issue on the Grails Jira for this problem.

ellerycrane avatar Nov 24 '12 04:11 ellerycrane

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.

ldaley avatar Nov 25 '12 10:11 ldaley

It's been almost a year with no activity. Is it difficult to add the work-around to grails-launcher?

justenwalker avatar Oct 21 '13 15:10 justenwalker