blob: 758ab39666c27264dccaba0d285fdb392ffacd01 [file] [log] [blame]
BOOKS SAMPLE APPLICATION FOR GRAILS
===================================
This sample application demonstrates a simple page flow application that maintains a list of books.
The directory structure is:
<root>
/grails-app
/BookFlow.groovy
/jsp
/listBooks.jsp
/bookDetail.jsp
This application clearly demonstrates how compact Grails applications are and how little configuration is required.
BUILDING
========
If you have obtained Grails from CVS make sure the JAR file is build by running this command in the Grails home directory:
ant jar
To deploy this application set the GRAILS_HOME environment to the root directory of the Grails distribution or project.
At the command prompt change directory to the project root directory which is ${GRAILS_HOME}/samples/books.
Next run this command to initiate the dictory structure:
${GRAILS_HOME}/bin/grails init
If you get "permission denied", this file is not executable. In that case run the command as follows:
/bin/sh ${GRAILS_HOME}/bin/grails init
Then run this command to create the WAR file:
${GRAILS_HOME}/bin/grails war
This application is written against the Servlet 2.3 specifications so should run in any servlet container.
Deploy grails-app.war in you servlet container (for most containers this mean copying the file in the webapps folder).
Browse to http://<server_address>:<server_port>/grails-app/app/books to test the application. You can also rename the WAR file to use another context path.
Please post a message on the Grails mailing list if you experience any problems running this sample application.
Steven
ALTERNATIVE
===========
With a Groovy installation in place, you can build, run, and test the grails book sample by running
groovy build.groovy
To make this happen, you need
- a webserver installation like tomcat (recommended: tomcat 5)
- a download of Canoo WebTest from http://webtest.canoo.com/webtest/build.zip
to a directory that is referred to as WEBTEST_HOME
Getting the classpath for testing right, requires a bit of work.
- adapt your GROOVY_HOME/conf/groovy_classworlds.conf to include your
${user.home}/.groovy/lib dir
- copy all jar files from WEBTEST_HOME/lib and its subdirs to
${user.home}/.groovy/lib (i.e. 'flat')
- adapt the settings in build.properties to your personal needs
when using with tomcat 5 make sure to copy
TOMCAT_HOME/server/catalina_ant.jar to ${user.home}/.groovy/lib
[todo: provide an installer script]
After running 'groovy build.groovy' successfully you find the test reports
in tmp/webtest/results/WebTestResults.html
When running on windows, this file will be automatically opened for you
in your default browser.