薄薄的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 閱讀(1425) 評論(0)  編輯  收藏 所屬分類: Groovy涉獵

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          <2025年5月>
          27282930123
          45678910
          11121314151617
          18192021222324
          25262728293031
          1234567

          留言簿

          文章分類

          文章檔案

          收藏夾

          搜索

          •  

          最新評論

          主站蜘蛛池模板: 呼玛县| 富阳市| 佛学| 兴文县| 新巴尔虎右旗| 成都市| 许昌市| 恩施市| 灵璧县| 怀远县| 葫芦岛市| 涞水县| 辽宁省| 潼关县| 河源市| 连江县| 通州区| 安岳县| 丽水市| 乐山市| 诸暨市| 拉孜县| 观塘区| 宜黄县| 富民县| 铁岭市| 全椒县| 鱼台县| 华宁县| 新源县| 鲁甸县| 桑日县| 花垣县| 海丰县| 东宁县| 高平市| 荣昌县| 昌邑市| 竹北市| 丹江口市| 顺义区|