用户操作
[留言]  [发消息]  [加为好友] 
订阅我的博客
XML聚合    FeedSky
订阅到鲜果
订阅到Google
订阅到抓虾
delva的公告
<script src="http://www.xcinfo.ha.cn/jsq/default.asp?User=imdelva&Length=6&x=15&y=20&Mode=020"></script> <br> <br> <font color=red> <b>Name:Eric Han<br> QQ:2922884 </b> </font> <a target=blank href=http://wpa.qq.com/msgrd?V=1&Uin=2922884&Site=Blog.CSDN.Net/AppleBBS&Menu=yes><img border="0" SRC=http://wpa.qq.com/pa?p=1:25941:13 alt="My QQ:2922884,给我发消息!"></a> <h2>Delva·气象站</h2> <IFRAME ID='ifm2' WIDTH='189' HEIGHT='190' ALIGN='CENTER' MARGINWIDTH='0' MARGINHEIGHT='0' HSPACE='0' VSPACE='0' FRAMEBORDER='0' SCROLLING='NO' SRC='http://weather.qq.com/inc/ss125.htm'></IFRAME>
文章分类
友情提供
ξσ Dicky's Blog σξ
掌中博客
攻难题很土匪 学技术强盗
专家博客
aiirii
mingjava--J2ME
左轻侯
桂枝香在故国晚秋
熊节
王咏刚
蔡学镛
韩磊
存档

原创  Groovy on Grails 快速建站 收藏

  1. Groovy on Grails 快速建站
  2. grails版本:1.0.2
  3. 首先,确保环境变量中配置了:
  4. GRAILS_HOME=F:\grails-1.0.2
  5. 以下是建站的日志,黑体为用户输入部分:
  6. E:\>mkdir cinwamanblog
  7. E:\>cd cinwamanblog
  8. 创建应用
  9. E:\cinwamanblog>grails create-app
  10. Welcome to Grails 1.0.2 - http://grails.org/
  11. Licensed under Apache Standard License 2.0
  12. Grails home is set to: F:\grails-1.0.2
  13. Base Directory: E:\cinwamanblog
  14. Note: No plugin scripts found
  15. Running script F:\grails-1.0.2\scripts\CreateApp.groovy
  16. Environment set to development
  17. Application name not specified. Please enter:
  18. cinwamanblog
  19.     [mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src
  20.     [mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src\java
  21.     [mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src\groovy
  22. …… 
  23.      [copy] Copying 2 files to E:\cinwamanblog\cinwamanblog
  24.      [copy] Copying 2 files to E:\cinwamanblog\cinwamanblog\web-app\WEB-INF
  25. ……
  26. [propertyfile] Updating property file: E:\cinwamanblog\cinwamanblog\application.
  27. properties
  28. Created Grails Application at E:\cinwamanblog/cinwamanblog
  29. 运行
  30. E:\cinwamanblog\cinwamanblog>grails run-app
  31. Welcome to Grails 1.0.2 - http://grails.org/
  32. Licensed under Apache Standard License 2.0
  33. Grails home is set to: F:\grails-1.0.2
  34. Base Directory: E:\cinwamanblog\cinwamanblog
  35. Note: No plugin scripts found
  36. ……
  37. 2008-09-04 01:15:43.427::INFO:  Started SelectChannelConnector@0.0.0.0:8080
  38. Server running. Browse to http://localhost:8080/cinwamanblog
  39. 2008-09-04 01:16:02.494:/cinwamanblog:INFO:  GSP servlet initialized
  40. 访问:http://localhost:8080/cinwamanblog 测试是否网站建立起来
  41. 创建领域实体
  42. E:\cinwamanblog\cinwamanblog>grails create-domain-class
  43. Welcome to Grails 1.0.2 - http://grails.org/
  44. Licensed under Apache Standard License 2.0
  45. Grails home is set to: F:\grails-1.0.2
  46. Base Directory: E:\cinwamanblog\cinwamanblog
  47. Note: No plugin scripts found
  48. Running script F:\grails-1.0.2\scripts\CreateDomainClass.groovy
  49. Environment set to development
  50.  name not specified. Please enter:
  51. Article
  52.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\grails-app\domain
  53. Created  for Article
  54.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\test\integration
  55. Created Tests for Article
  56. E:\cinwamanblog\cinwamanblog>grails create-domain-class
  57. ……
  58.  name not specified. Please enter:
  59. catalog
  60.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\grails-app\domain
  61. Created  for Catalog
  62.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\test\integration
  63. Created Tests for Catalog
  64. E:\cinwamanblog\cinwamanblog>grails create-domain-class
  65. ……
  66.  name not specified. Please enter:
  67. person
  68.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\grails-app\domain
  69. Created  for Person
  70.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\test\integration
  71. Created Tests for Person
  72. E:\cinwamanblog\cinwamanblog>grails create-domain-class
  73. ……
  74.  name not specified. Please enter:
  75. blog
  76.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\grails-app\domain
  77. Created  for Blog
  78.      [copy] Copying 1 file to E:\cinwamanblog\cinwamanblog\test\integration
  79. Created Tests for Blog
  80. 创建控制类
  81. E:\cinwamanblog\cinwamanblog>grails create-controller
  82. ……
  83. Controller name not specified. Please enter:
  84. blog
  85. ……
  86. E:\cinwamanblog\cinwamanblog>grails create-controller
  87. ……
  88. catalog
  89. ……
  90. E:\cinwamanblog\cinwamanblog>grails create-controller
  91. ……
  92. article
  93. ……
  94. E:\cinwamanblog\cinwamanblog>grails create-controller
  95. ……
  96. person
  97. ……
  98. E:\cinwamanblog\cinwamanblog>
  99. 使用mysql创建3个空库:开发:blog_dev 测试:blog_test 运营:blog_prod
  100. 修改配置文件:
  101. E:\cinwamanblog\cinwamanblog\grails-app\conf\DataSource.groovy
  102. dataSource {
  103.     pooled = true 
  104.   dbCreate = "update" 
  105.   url = "jdbc:mysql://localhost/blog_dev" 
  106.   driverClassName = "com.mysql.jdbc.Driver" 
  107.   username = "root" 
  108.   password = "root" 
  109. }
  110. hibernate {
  111.     cache.use_second_level_cache=true
  112.     cache.use_query_cache=true
  113.     cache.provider_class='org.hibernate.cache.EhCacheProvider'
  114. }
  115. // environment specific settings
  116. environments {
  117.     development {
  118.         dataSource {
  119.             dbCreate = "create-drop" // one of 'create', 'create-drop','update'
  120.             url = "jdbc:mysql://localhost/blog_dev"
  121.         }
  122.     }
  123.     test {
  124.         dataSource {
  125.             dbCreate = "update"
  126.             url = "jdbc:mysql://localhost/blog_test"
  127.         }
  128.     }
  129.     production {
  130.         dataSource {
  131.             dbCreate = "update"
  132.             url = "jdbc:mysql://localhost/blog_prod"
  133.         }
  134.     }
  135. }
  136. ctrl+c 停止应用,然后E:\cinwamanblog\cinwamanblog>grails run-app
  137. 此时,数据库中的表自动创建

发表于 @ 2008年09月04日 12:03:00 | 评论( loading... ) | 编辑| 举报| 收藏

旧一篇:Groovy的闭包示例 | 新一篇:Flex亲密接触java

  • 发表评论
  • 评论内容:
  •  
Copyright © delva
Powered by CSDN Blog