Japanese Command Line Tools

Last updated by admin 4 years ago

Grails ????? {excerpt:hidden=true}The Grails console{excerpt}

{excerpt:hidden=true} Grails ships with an extended version of the regular Groovy console. To run the console simply type the following command from the root of a Grails project: {excerpt} Grails?????Groovy?????????????????????????????????????????Grails??????????????????????????????:
grails console
{excerpt:hidden=true} The console is a Swing GUI interface that lets you type arbitrary commands and execute them. It is a good way to learn Grails and try out the various dynamic finders available on your domain model.{excerpt} ????????Swing GUI???????????????????????????????????Grails????????????????????????????????????????????????????????

Grails??????? {excerpt:hidden=true}The Grails interactive shell{excerpt}

{excerpt:hidden=true} In addition to the console there is the interactive shell. It works similar to the console but with a text UI only. To run the shell simply type the following command from the root of a Grails project:{excerpt} ????????????????????????????????????????????????????????????????????????????Grails?????????????????????????:

grails shell

{excerpt:hidden=true} There are instructions on how to use it when it loads, but essentially you type in the commands you want to execute separated by carriage returns and you then type go followed by a carriage return to execute the commands.{excerpt} ?????????????????????????????????????????????(+??????)????????"go"(+??????)??????????????????????

??????? {excerpt:hidden=true}General usage{excerpt}

{excerpt:hidden=true} Both console and shell are useful for working interactively with your Grails application:{excerpt} ??????????????Grails????????????????????????: {excerpt:hidden=true}

  • find domain objects with the help of dynamic finder methods
  • call mutator methods on domain objects once you have a reference to them
  • save() or delete() domain objects like you would otherwise do in a controller
  • … _more to come here_{excerpt}
  • ???????????????????????????????
  • ??????????????????????????????????(?????????????????)?????
  • ???????????save()?delete()?????????????????????????????????
  • … _more to come here_
{excerpt:hidden=true} Such an interactive work can be helpful for debugging purposes, for verifying your assumptions about the object state and behavior, to test the effect of dynamic finder methods before putting the code in a controller.{excerpt} ??????????????????????????????????????????????????????????????????????????????????????????????????????? {excerpt:hidden=true} Below is a transcript of an example session with a grails shell for a fictious book store application.{excerpt} ???????book store?????????????grails?????session???????
.... more to come here

WAR???????? {excerpt:hidden=true}Packaging a WAR{excerpt}

{excerpt:hidden=true} To package a WAR file for deployment onto an application server you can do:{excerpt} ?????????????WAR?????????????????????

grails war
{excerpt:hidden=true} By default this will package for a production environment you can change this by doing:{excerpt} ????????production???????????????????????
grails test war // test(???) ???
grails dev war  // development(??) ???
grails prod war // production(??) ?
{excerpt:hidden=true} If you want to package for X other environment you can do:{excerpt} ????????????????????
grails -Dgrails.env=blah war