薄薄的Java
技术本来很广,但我们可以把它变薄!
posts - 0,  comments - 2,  trackbacks - 0

首先,让我们来搭建起开发Grails的环境。在Windows平台下,他的配置和Java的环境十分相似,那我们一步一步开始吧!
一、下载最新的发布版本:http://www.grails.org.解压后备用。本人把解压后的文件置于Grooy目录下。(以后的开发都在Groovy目录下完成,最好再建个目录projects)
二、设置GRAILS_HOME环境变量,类似于Java环境变量,找到解压后的根目录,如:E:\Groovy\grails-1.0.4 
三、将GRAILS_HOME加入到PATH中,%GRAILS_HOME%/bin

OK,现在测试一下,命令行下输入grails,如图:



好了,准备工作就绪,让我们开始介绍几个简单的命令吧!

命令行下输入grails help,先来看看grails的基本命令吧

 1C:\>grails help
 2
 3Welcome to Grails 1.0.4 - http://grails.org/
 4Licensed under Apache Standard License 2.0
 5Grails home is set to: E:\Groovy\grails-1.0.4        
 6        
 7Base Directory: C:\
 8Note: No plugin scripts found
 9Running script E:\Groovy\grails-1.0.4\scripts\Help.groovy
10Environment set to development
11
12        Usage (optionals marked with *): 
13        grails [environment][target] [arguments]*
14
15        Examples: 
16        grails dev run-app    
17        grails create-app books
18
19        Available Targets (type grails help 'target-name' for more info):
20grails bootstrap
21grails bug-report
22grails clean
23grails compile
24grails console
25grails create-app
26grails create-controller
27grails create-domain-class
28grails create-filters
29grails create-integration-test
30grails create-plugin
31grails create-script
32grails create-service
33grails create-tag-lib
34grails create-unit-test
35grails doc
36grails generate-all
37grails generate-controller
38grails generate-views
39grails help
40grails init
41grails install-plugin
42grails install-templates
43grails list-plugins
44grails package
45grails package-plugin
46grails plugin-info
47grails release-plugin
48grails run-app
49grails run-app-https
50grails run-war
51grails set-proxy
52grails set-version
53grails shell
54grails stats
55grails test-app
56grails upgrade
57grails war
前面是命令格式介绍,后面从20-57行总共38条命令,在应用中会逐一介绍。
其中,应用创建命令grails create-app最为常用,它会为我们创建一个标准的规范化的grails应用框架目录。如图,
 1E:\Groovy\projects>grails create-app hello
 2
 3Welcome to Grails 1.0.4 - http://grails.org/
 4Licensed under Apache Standard License 2.0
 5Grails home is set to: E:\Groovy\grails-1.0.4        
 6        
 7Base Directory: E:\Groovy\projects
 8Note: No plugin scripts found
 9Running script E:\Groovy\grails-1.0.4\scripts\CreateApp.groovy
10Environment set to development
11    [mkdir] Created dir: E:\Groovy\projects\hello\src
12    [mkdir] Created dir: E:\Groovy\projects\hello\src\java
13    [mkdir] Created dir: E:\Groovy\projects\hello\src\groovy
14    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app
15    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\controllers
16    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\services
17    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\domain
18    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\taglib
19    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\utils
20    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\views
21    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\views\layouts
22    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\i18n
23    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\conf
24    [mkdir] Created dir: E:\Groovy\projects\hello\test
25    [mkdir] Created dir: E:\Groovy\projects\hello\test\unit
26    [mkdir] Created dir: E:\Groovy\projects\hello\test\integration
27    [mkdir] Created dir: E:\Groovy\projects\hello\scripts
28    [mkdir] Created dir: E:\Groovy\projects\hello\web-app
29    [mkdir] Created dir: E:\Groovy\projects\hello\web-app\js
30    [mkdir] Created dir: E:\Groovy\projects\hello\web-app\css
31    [mkdir] Created dir: E:\Groovy\projects\hello\web-app\images
32    [mkdir] Created dir: E:\Groovy\projects\hello\web-app\META-INF
33    [mkdir] Created dir: E:\Groovy\projects\hello\lib
34    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\conf\spring
35    [mkdir] Created dir: E:\Groovy\projects\hello\grails-app\conf\hibernate
36[propertyfile] Creating new property file: E:\Groovy\projects\hello\application.properties
37     [copy] Copying 2 files to E:\Groovy\projects\hello
38     [copy] Copied 1 empty directory to 1 empty directory under E:\Groovy\projects\hello
39     [copy] Copying 2 files to E:\Groovy\projects\hello\web-app\WEB-INF
40     [copy] Copying 5 files to E:\Groovy\projects\hello\web-app\WEB-INF\tld
41     [copy] Copying 28 files to E:\Groovy\projects\hello\web-app
42     [copy] Copying 18 files to E:\Groovy\projects\hello\grails-app
43     [copy] Copying 1 file to E:\Groovy\projects\hello
44     [copy] Copying 1 file to E:\Groovy\projects\hello
45     [copy] Copying 1 file to E:\Groovy\projects\hello
46     [copy] Copying 1 file to E:\Groovy\projects\hello
47[propertyfile] Updating property file: E:\Groovy\projects\hello\application.properties
48Created Grails Application at E:\Groovy\projects/hello

Hello是我们创建的第一个grails应用,grails自动为我们创建必要的目录结构。

下节我们将基于这个目录结构,进行第一个入门的HelloWorld应用开发。
posted on 2009-03-10 11:19 Rique 阅读(1407) 评论(0)  编辑  收藏 所属分类: Groovy涉猎

只有注册用户登录后才能发表评论。


网站导航:
 

<2024年10月>
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

留言簿

文章分类

文章档案

收藏夹

搜索

  •  

最新评论