智在居士草堂
本来无一物 何处惹尘埃
条新通知
登录
注册
欢迎
退出
我的博客
配置
写文章
文章管理
博客首页
全站
当前博客
空间
博客
好友
相册
留言
用户操作
[留言]
[发消息]
[加为好友]
订阅我的博客
[编辑]
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>
[编辑]
文章分类
1 .NET
2 Delphi
3 Java
4 Oracle
5 脚本
6 neoDatis odb
7 自语
8 Groovy
9 Flex
[编辑]
友情提供
ξσ Dicky's Blog σξ
掌中博客
攻难题很土匪 学技术强盗
[编辑]
专家博客
aiirii
mingjava--J2ME
左轻侯
桂枝香在故国晚秋
熊节
王咏刚
蔡学镛
韩磊
存档
2009年01月(1)
2008年09月(3)
2008年08月(2)
2008年07月(1)
2008年06月(4)
2008年05月(6)
2008年04月(2)
2006年02月(9)
2005年07月(1)
2005年04月(6)
2005年03月(16)
2005年02月(1)
2005年01月(10)
2004年12月(14)
2004年11月(12)
2004年03月(3)
Groovy on Grails 快速建站
收藏
Groovy on Grails 快速建站
grails版本:
1.0
.
2
首先,确保环境变量中配置了:
GRAILS_HOME=F:\grails-
1.0
.
2
以下是建站的日志,黑体为用户输入部分:
E:\>mkdir cinwamanblog
E:\>cd cinwamanblog
创建应用
E:\cinwamanblog>grails create-app
Welcome to Grails
1.0
.
2
- http:
//grails.org/
Licensed under Apache Standard License
2.0
Grails home is set to: F:\grails-
1.0
.
2
Base Directory: E:\cinwamanblog
Note: No plugin scripts found
Running script F:\grails-
1.0
.
2
\scripts\CreateApp.groovy
Environment set to development
Application name not specified. Please enter:
cinwamanblog
[mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src
[mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src\java
[mkdir] Created dir: E:\cinwamanblog\cinwamanblog\src\groovy
……
[copy] Copying
2
files to E:\cinwamanblog\cinwamanblog
[copy] Copying
2
files to E:\cinwamanblog\cinwamanblog\web-app\WEB-INF
……
[propertyfile] Updating property file: E:\cinwamanblog\cinwamanblog\application.
properties
Created Grails Application at E:\cinwamanblog/cinwamanblog
运行
E:\cinwamanblog\cinwamanblog>grails run-app
Welcome to Grails
1.0
.
2
- http:
//grails.org/
Licensed under Apache Standard License
2.0
Grails home is set to: F:\grails-
1.0
.
2
Base Directory: E:\cinwamanblog\cinwamanblog
Note: No plugin scripts found
……
2008
-
09
-
04
01
:
15
:
43.427
::INFO: Started SelectChannelConnector
@0
.0.
0.0
:
8080
Server running. Browse to http:
//localhost:8080/cinwamanblog
2008
-
09
-
04
01
:
16
:
02.494
:/cinwamanblog:INFO: GSP servlet initialized
访问:http:
//localhost:8080/cinwamanblog 测试是否网站建立起来
创建领域实体
E:\cinwamanblog\cinwamanblog>grails create-domain-
class
Welcome to Grails
1.0
.
2
- http:
//grails.org/
Licensed under Apache Standard License
2.0
Grails home is set to: F:\grails-
1.0
.
2
Base Directory: E:\cinwamanblog\cinwamanblog
Note: No plugin scripts found
Running script F:\grails-
1.0
.
2
\scripts\CreateDomainClass.groovy
Environment set to development
name not specified. Please enter:
Article
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\grails-app\domain
Created
for
Article
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\test\integration
Created Tests
for
Article
E:\cinwamanblog\cinwamanblog>grails create-domain-
class
……
name not specified. Please enter:
catalog
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\grails-app\domain
Created
for
Catalog
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\test\integration
Created Tests
for
Catalog
E:\cinwamanblog\cinwamanblog>grails create-domain-
class
……
name not specified. Please enter:
person
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\grails-app\domain
Created
for
Person
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\test\integration
Created Tests
for
Person
E:\cinwamanblog\cinwamanblog>grails create-domain-
class
……
name not specified. Please enter:
blog
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\grails-app\domain
Created
for
Blog
[copy] Copying
1
file to E:\cinwamanblog\cinwamanblog\test\integration
Created Tests
for
Blog
创建控制类
E:\cinwamanblog\cinwamanblog>grails create-controller
……
Controller name not specified. Please enter:
blog
……
E:\cinwamanblog\cinwamanblog>grails create-controller
……
catalog
……
E:\cinwamanblog\cinwamanblog>grails create-controller
……
article
……
E:\cinwamanblog\cinwamanblog>grails create-controller
……
person
……
E:\cinwamanblog\cinwamanblog>
使用mysql创建
3
个空库:开发:blog_dev 测试:blog_test 运营:blog_prod
修改配置文件:
E:\cinwamanblog\cinwamanblog\grails-app\conf\DataSource.groovy
dataSource {
pooled =
true
dbCreate =
"update"
url =
"jdbc:mysql://localhost/blog_dev"
driverClassName =
"com.mysql.jdbc.Driver"
username =
"root"
password =
"root"
}
hibernate {
cache.use_second_level_cache=
true
cache.use_query_cache=
true
cache.provider_class=
'org.hibernate.cache.EhCacheProvider'
}
// environment specific settings
environments {
development {
dataSource {
dbCreate =
"create-drop"
// one of 'create', 'create-drop','update'
url =
"jdbc:mysql://localhost/blog_dev"
}
}
test {
dataSource {
dbCreate =
"update"
url =
"jdbc:mysql://localhost/blog_test"
}
}
production {
dataSource {
dbCreate =
"update"
url =
"jdbc:mysql://localhost/blog_prod"
}
}
}
ctrl+c 停止应用,然后E:\cinwamanblog\cinwamanblog>grails run-app
此时,数据库中的表自动创建
发表于 @ 2008年09月04日 12:03:00 |
评论(
loading...
)
|
编辑
|
举报
|
收藏
旧一篇:Groovy的闭包示例
|
新一篇:Flex亲密接触java
查看最新精华文章 请访问博客首页
相关文章
发表评论
表 情:
评论内容:
用 户 名:
登录
注册
匿名评论
验 证 码:
重新获得验证码