spring roo quick start

前提:

maven3(估计maven2)也行吧,我这里用的是maven3

 jdk6


1 download  

http://www.springsource.org/download/community?project=Spring%2520Roo

2 unzip 

    unzip to your favor dir  ,

    such  as

    D:\Java\spring-roo-1.2.3.RELEASE

3 set ROO_HOME

    ROO_HOME= D:\Java\spring-roo-1.2.3.RELEASE

4 set path

 path=path;%ROO_HOME%\bin;

5 validate 

    cmd ,then input command:roo

spring roo quick start_第1张图片

6 create a project

make a dir as the project root 

 such as

E:\Users\wujiahua\roo

then cmd this dir,

spring roo quick start_第2张图片

然后执行:

project --topLevelPackage org.bean.roodemo --projectName roodemo
创建了一个项目

7 create persistent mechanism

roo> jpa setup --provider HIBERNATE --database MYSQL

8 create two entity

entity jpa --class ~.domain.Speaker

 entity jpa --class  ~.domain.Talker
9 create field  for entities

 9.1 for Speaker

field string --fieldName  firstname

field string lastname

field string  email

field string  organization

field date --fieldName birthdate --type 

field number --fieldName age --min 25 --max 60 --type  java.lang.Longate --past --notNull
注意:以上代码是在加入Speaker 实体之后再执行的

9.2  for Talker

field string --fieldName title --class ~.domain.Talk --notNull

field string --fieldName description --notNull --sizeM 400
10 create relation
field set --fieldName talks  --class ~.domain.Speaker --cardinality ONE_TO_MANY --type ~.domain.Talker


field reference --fieldName speaker --class ~.domain.Talker --type ~.domain.Speaker

11 搭建web层

controller all --package ~.web
点击   scaffold了解真相

12 run

输入 q或quit之后 推出roo

然后再控制台输入

mvn tomcat:run 即可


结果不幸报错:

[ERROR] Failed to execute goal on project roodemo: Could not resolve dependencie
s for project org.bean.roodemo:roodemo:war:0.1.0.BUILD-SNAPSHOT: Could not find
artifact org.springframework.roo:org.springframework.roo.annotations:jar:1.2.3.R
ELEASE in nexus (http://localhost:8081/nexus/content/groups/public/) -> [Help 1]

解决:

进入目录

D:\Java\maven\repository\repository\org\springframework\roo\org.springframework.roo.annotations\1.2.3.RELEASE

删掉里面所有的东西 重新运行

还是不行,把ROO_HOME(D:\Java\spring-roo-1.2.3.RELEASE\annotations)中的org.springframework.roo.annotations-1.2.3.RELEASE.jar拷贝到:

D:\Java\maven\repository\repository\org\springframework\roo\org.springframework.roo.annotations\1.2.3.RELEASE

然后再次执行 mvn tomcat:run

等待。。下载jar中.....


spring roo quick start_第3张图片 貌似成功了,

在浏览器中输入

http://localhost:8080/roodemo/

spring roo quick start_第4张图片


终于成功了!!!!!!

参考资料:

http://www.ibm.com/developerworks/cn/opensource/os-springroo1/(其实大同小异啦 因为自己用的版本更新,有些操作好像不信了,然后自己通过hint琢磨出来现在这个样子) 另外这篇文章中还介绍了 windows上自己构建spring roo的方法!!!明天抽个时间看看......




你可能感兴趣的:(spring,start,roo,Quick,;)