I’m looking for a way to run “generate-controller” from the command line for a mavenized grails 2.1.0 project (ie. grails-maven-plugin 2.1.0). I have tried the following:
mvn grails:generate-controller– when running this I get an error saying “java.lang.IllegalStateException: User input is not enabled, cannot obtain input stream”. For some reason, grails appears to not be able to read from the console (to obtain the name of the domain class).- http://jira.grails.org/browse/MAVEN-172 describes this error; I tried both solutions mentioned here (deleting the grails project cache and running mvn clean) but neither solved the problem
mvn grails:exec "grails:generate-controller"– this results in aorg.codehaus.groovy.grails.cli.ScriptNotFoundException
Is there a way to specify the name of the domain class via command-line parameter – ie. something like mvn generate-controller -DclassName=my.domain.class.name?
It’s not necessarily intuitive, but in general mvn grails:help is useful.
For help about creating domain classes and controllers
Sample domain class and controller
UPDATE per comments received : If you happen to use MS Windows, please quote the
-DdomainClassName argument values below.
[UPDATE]
Blatant advertising, but I will create a second video for Maven and Grails integration soon, as you’re not the only one with similar questions. The first one can be found here, very generic and for starters.
Hope it helps.