本文档采用jdk1.8+intellij2015+grails3.x搭建项目环境,之前多次碰壁,花了点时间写了这个文档,希望多朋友们有帮助。控制丽板主系统性主升心设备恰理当名硬体统保护程魯远程设置进行大多数系统你须作曾理是登录粤应级系结设←性能视觉效果,处理器计划,内存使用小及虚内存册除D〕厍产件登录户柜关的貝面置环境变量cN)-5、在系统变量栏点击新建:新建系统变量要量名〔NGRAILS HOME变量值COE:grails-3.1.5取蹈6、在系统变量栏找到Path,在末尾加上:;% GRADLE HOME%\bin,确定编辑系变量变量名(N〕交量值CATortoiseSVN\bing%&GRADLE HOME E bin确7、测试:打开dos命令窗口,运行: grails-version园价面和为1于的旱岸开:cm司成功C: Windows\system 32\cmd.exeicrosoft windows l版本63兴』〉2a13 Microsoft Corporation。保留所利Grails vGroovy Uersion: 2-4-6JUM CRIon: 1.8.5 7山 Isers'rxey8、配置 Java jdk坏境变量,jdk安装跟前面 grails安装差不多8.1新建变量: JAVA HOM变量值:E:\Java、jdk1.88.2编辑Path,在末尾加上% AVA HOME为bin;% JAVA HOME为、 Gre bin;(前面没有分号的加上分号)8.3新建:变量: CLASSPAT!变量值:;% JAVA IIOME%1ib;% JAVA IIOME%\1ib\ tools.jar测试:\wir: 1c)\syslerTI3>\IrIt1exH213 Microsoft Corporation、保留所有利s是量5x巴y)U&U些了5nU魂T的卫卫Lm七im吧E门U工Cbir1.8,一b32刁UH幽 mn cTT》4一盲tS户pUPU9 DefaultsCommand⊥ine:run appoptiEnvironment variablesAdd --classpath: F: \grails2016\ebms\untitled\build\resourceCancelApplyHcl10、成功Owelmeme to国-DApplication Sia!uE- Arefs:nettled PlLWelcome to GrailsLILIeluaiu Is, wu. ttd,e sLLesMulf slarLL ycant ycu may chooseof -crbrdlas that gecirenth e(注:如果要导入 grails项目到inte"中,首先要经过前面的步骤,新建一个测试项目先跑起来,这样的话能能测试你的运行环境是否正常,否则在你不知道运行环境是否正常的情况下就开始导入新项目,这样很难排查真正的问题,影响开发速度。所以,做开发的测试很重要,特别是在建立第·个项目的吋候,切记,·定要先测试运行环境!!!)grails integrate-with --intellijgrails upgrade添加 grails支持的几种方法:导入项目添加grai支持:1ght click your Rails noduleClick"Au [r drrlewyur k suppUr LThe drcpdown next to Use library will allow you to choose a grails li=raryOk< is configured thenDa ProiectId Framework Support.trc IXCOpYStoStra -+Mschartog Add FraPleast selecT u e ueit =d Led oldies.T his will download all needed hbraries and create haces in project configuraton;A口 plication ServerUse libraryCreatesaBeansuIPPEsr Icefacessf Openfacesr PrimefacesCERESTfu webservicessF Richfarespportwcoscrviccs clientOK Cance I lelp导入项日添加 grails支持:2I have thE Intelli 12 too. to run app i just click in ' FileEate Project. select Grails Projecta: Application Modu,日 mpty ModuleProjcct sDK:160vG Groovy ModuleFs Grails ModuleGrails modules are used for creating Grails applications导 Grifton ModuleC Java Moculee Intel) ID=a Plugin日32 ME Modulen》 Maven NoduleJ0 New Projectal gralis-24Ugrails-2.2.0 Ibrary will be usedliLk errI CreaL=, selecT LfIe fuller, vf iu LurI_di l Lhe Grails 2, drId vuild. -If you has the project before, run in proje=t rails intecrate-vwith --j ntelli or run import project, andcreate a Grails sDk.导入项目添加grai支持:3Project structure<=> Global libraries添加 grails所在目录:已nai1=-3.1-5Name: BralPEDsc七tm=Library DfREL LaSt range versio15d主st\grai1s- asYnc-5-且Glcbol Librarie3.1.5d十ga主Nai1.5然di1s-3ULsi1s-当d正st\g护a工111d+、已I E:grails 3.1.5\dist\grails grodlc1gn3.1.5.5or兰11-3Jarai⊥sdis t\grails-plugin-async-31-5.arEl E: \grails 3.1-5\dist\grails旦r通工s-3dist\grailntrollers-3.1rai⊥s-3BI E: sgrails-3-1-5\dist\grails-plugin-databinding-3-1E:gai13.1.5、d当t已rai15p1 upin dota5 ource3.1,5K CancelHe⊥p