Transferred from: http://blog.csdn.net/jun55xiu/article/details/9380213
One: Installation
Note: Can participate in official website Spring-roo:
Static.springsource.org/spring-roo/reference/html/intro.html#intro-exploring-sampleroo_opts
Http://static.springsource.org/spring-roo/reference/html/intro.html#intro-exploring-sample
Http://static.springsource.org/spring-roo/reference/html/beginning.html
Http://www.springsource.org/samples
1: Download Spring-roo-1.2.4.release.zip installation package at http://www.springsource.org/download/community
2: After decompression, the decompression path (e:\ knowledge accumulation \spring3 Framework Study \5 spring-roo-1.2.4\spring-roo-1.2.4.release\bin) configuration to the system environment variable path, execute cmd into bin/, execute
Roo quit appears roo logo icon count installation success, such as :
3 selectable roo_opts Configuration
At present the only configuration settings available is roo.bright. This causes foreground messages in the shell is displayed with brighter colors. This is potentially useful if your background color are light (e.g. white). You can set the variable using the following commands:
Export roo_opts= "-droo.bright=true" set roo_opts= "-droo.bright=true" //Windows users
Two: Ten-minutes Program example
1: Create program directory ten-minutes (stored in: e:\ knowledge accumulation \SPRING3 Framework study \5 Spring-roo-1.2.4\spring-roo-1.2.4.release)
CMD:CD e:
Cmd:mkdir ten-minutes
CMD:CD ten-minutes
Cmd:roo
Enter the roo shell command
2 Creating Related Programs section configuration files and class packages
Project--toplevelpackage com.tenminutescreated/home/balex/ten-minutes/pom.xmlcreated SRC_MAIN_JAVACreated SRC_ main_resourcescreated src_test_javacreated src_test_resourcescreated src_main_webappcreated SRC_MAIN_RESOURCES/ Meta-inf/springcreated SRC_MAIN_RESOURCES/META-INF/SPRING/APPLICATIONCONTEXT.XML3 Press hint to generate the database file (current database uses hypersonic_in_memory, data is stored in memory)
Hintroo requires the installation of a JPA provider and associated database. Type ' JPA Setup ' and then-hit TAB three times. We suggest you the type ' H ' then tab to complete "HIBERNATE". After the--provider, press TAB twice for database choices. For testing purposes, type (or TAB) hypersonic_in_memory. If you press TAB again, you'll see there is no more options. As such, you ' re ready to press ENTER to execute the command.
That
JPA Setup--provider HIBERNATE--database hypersonic_in_memory
4 other steps
MVN Tomcat:run
5 Follow-up
The "perform" commands could has been easily undertaken from the command prompt using "MVN" instead. We just do them from within Roo to benefit from TAB completion. You could has also skipped the "perform Eclipse" command if you are using the M2eclipse plugin. If you is using SpringSource Tool Suite (STS), it automatically includes m2eclipse and as such you does not need "Perform eclipse" command. Indeed If you ' re a STS user, you could has started your Roo project right from within the IDE by selecting the File > New > Spring Roo menu option and completing the steps. In this case a Roo Shell view would open within STS and from there you can enter the remaining commands.
Now so you ' ve loaded Tomcat, let's run the Selenium tests. You can do this by loading a new command window, changing to the Ten-minutes directory, and then executing mvn selenium:selenese
. You should see your FireFox Web browser execute the generated Selenium tests. You can also visit your new Web application athttp://localhost:8080/tenminutes, which should look similar to the picture B Elow.
6 Command Description
- roo> hint Roo will suggest what to do next
- Roo> Project--toplevelpackage Creating projects
- roo> Persistence Setup--providerhibernate--database Select the JPA and database you want to use
- roo> entity--class ~.domain. Timer--testautomatically New Entity
- roo> field string--fieldname message--notnull new property
- Roo> controller All--package ~.web set up controllers for all entity objects
- roo> Selenium Test--controller ~.web. Timercontroller build Selenium automated Web test scripts for controller
- Roo> Perform tests execution test
- Roo> Perform Package
- Roo> perform eclipse transforms a project into an Eclipse project
- Roo> Quit Roo Environment
MVN Tomcat:run publish the app to Tomcat and start the Tomcat Server.
Spring Roo Real Station (i) Deployment installation & First sample program