- 浏览: 2551871 次
- 性别:
- 来自: 成都
文章分类
最新评论
-
nation:
你好,在部署Mesos+Spark的运行环境时,出现一个现象, ...
Spark(4)Deal with Mesos -
sillycat:
AMAZON Relatedhttps://www.godad ...
AMAZON API Gateway(2)Client Side SSL with NGINX -
sillycat:
sudo usermod -aG docker ec2-use ...
Docker and VirtualBox(1)Set up Shared Disk for Virtual Box -
sillycat:
Every Half an Hour30 * * * * /u ...
Build Home NAS(3)Data Redundancy -
sillycat:
3 List the Cron Job I Have>c ...
Build Home NAS(3)Data Redundancy
Grails(12)Prepare My Working Environment
Part One Obtaining Environment Tools
1. Prepare my github account
2. Setting up MySQL
3. Grails with old version 1.3.7
Download the old version 1.3.7 from here http://grails.org/download
Unzip the file and put in my working directory and ln a link to /opt
So right now, I have my grails on /opt/grails-1.3.7
4. I already installed the STS.
5. Set Up Grails
Follow this document and set up grails
http://grails.org/doc/1.3.7/guide/2.%20Getting%20Started.html#2.1 Downloading and Installing
>cd ~/
>vi .profile
export GRAILS_HOME=/opt/grails-1.3.7
export PATH=/opt/grails-1.3.7/bin:$PATH
>. .profile
But when I type command grails, I get error message
Error Messages:
Error opening zip file or JAR manifest missing : /opt/grails-1.3.7/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-1.0.6.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Solution:
Maybe that is because my latest 2.1.0 version. I will uninstall my latest version first.
>sudo port uninstall grails @2.1.0_0
>grails help
And I type the command
>grails
I got the right version of 1.3.7.
6. STS Plug-in Acquisition
Dashboard ----> Grails Support and Groovy Eclipse
7. STS Grails Plug-in Set Up
References ----> Groovy ---> Grails ---->Add 1.3.7
And the groovy compile to 1.7
Part Two Setting Up My Workspace
1. Get all the project from github.
2. Set Up project Configuration
3. Importing Existing Projects
If there is not .project there in that project directory. Just create a new normal project on STS. Do not use import project.
>grails clean
>grails upgrade
And refresh the dependency in STS.
Finally, I successfully imported all the projects.
But my git can not fetch from remote from STS, I will fix that later.
4. Creating a User for the Database
Enter the mysql on my local machine
>mysql -uroot -p
mysql>create database sample;
mysql>grant all on sample.* to "username"@"localhost" identified by "111111";
mysql>exit;
Then login to the mysql with the newly created user and password.
>mysql -uusername -p111111
5.Upgrading Current Grails Application
upgrade all the grails project
6. Refresh Dependencies
7. Debugging
In STS, choose Debug Configurations ---> Create new in Grails and grails command
---> -DServer.port=9090 run-app
9. Creating Virtual Host
>vi /etc/hosts
Modify and find the virtual machine.
Part 3 Some Tips from Documents
2.6 Convention over Configuration
2.7 Running an Application
>grails -Dserver.port=9090 run-app
3. Configuration
3.1.3 GORM
3.7.2 Dependency Repositories
repositories {
mavenCentral()
ebr()
mavenRepo "http://repository.some.org"
}
Local Directory
repositories {
flatDir name:'myRepo', dirs: '/path/to/repo'
}
Local Maven repository ~/.m2/repository
repositories{
mavenLocal()
}
4. The Command Line
5. Object Relational Mapping(GORM)
Part 4 Groovy Review
Open groovy console
>groovyconsole
println "hello, Carl"
type <CTRL + R>
x = 1
println x
x = new java.util.Date()
println x
It seems that we do not have type for variables. So we can assign different value to them.
Lists and Maps
Built-in support for 2 data types, list for ordered collections of data.
myList = [12,-1,33,0]
println myList[1]
println myList.size()
Map is unordered collections
scores = ['carl': 168, 'kiko': 199]
println scores
println scores['carl'] //168
println scores.kiko //199
And we can easily adding one product to map scores
scores['peter'] = 1000
println scores.peter
Empty the map
emptyMap = [:]
emptyList = []
Closures
square = { it * it}
println square(9) // 81
newList = [1,3,4,5].collect(square)
println newList // [1, 9, 16, 25]
By default closures take 1 parameter called "it". A closure for map.
printMap = {key, value -> println key + "=" + value }
['carl': 168, 'kiko': 199].each(printMap)
//carl=168
//kiko=199
Part 5 Error Messages
I had error message when I tried to fetch the source codes from github in STS.
Error Messages:
https://github.com/name/project: https://github.com/name/project/info/refs?service=git-upload-pack not found
Solution:
Then I go to the STS and git clone the project in Git Repository Exploring, that works.
References:
http://grails.org/doc/1.3.7/guide/2.%20Getting%20Started.html#2.1 Downloading and Installing
http://grails.org/doc/1.3.7/
http://grails.org/doc/1.3.7/guide/3.%20Configuration.html
http://sillycat.iteye.com/blog/830627
http://sillycat.iteye.com/blog/830631
http://groovy.codehaus.org/Getting+Started+Guide
Part One Obtaining Environment Tools
1. Prepare my github account
2. Setting up MySQL
3. Grails with old version 1.3.7
Download the old version 1.3.7 from here http://grails.org/download
Unzip the file and put in my working directory and ln a link to /opt
So right now, I have my grails on /opt/grails-1.3.7
4. I already installed the STS.
5. Set Up Grails
Follow this document and set up grails
http://grails.org/doc/1.3.7/guide/2.%20Getting%20Started.html#2.1 Downloading and Installing
>cd ~/
>vi .profile
export GRAILS_HOME=/opt/grails-1.3.7
export PATH=/opt/grails-1.3.7/bin:$PATH
>. .profile
But when I type command grails, I get error message
Error Messages:
Error opening zip file or JAR manifest missing : /opt/grails-1.3.7/lib/com.springsource.springloaded/springloaded-core/jars/springloaded-core-1.0.6.jar
Error occurred during initialization of VM
agent library failed to init: instrument
Solution:
Maybe that is because my latest 2.1.0 version. I will uninstall my latest version first.
>sudo port uninstall grails @2.1.0_0
>grails help
And I type the command
>grails
I got the right version of 1.3.7.
6. STS Plug-in Acquisition
Dashboard ----> Grails Support and Groovy Eclipse
7. STS Grails Plug-in Set Up
References ----> Groovy ---> Grails ---->Add 1.3.7
And the groovy compile to 1.7
Part Two Setting Up My Workspace
1. Get all the project from github.
2. Set Up project Configuration
3. Importing Existing Projects
If there is not .project there in that project directory. Just create a new normal project on STS. Do not use import project.
>grails clean
>grails upgrade
And refresh the dependency in STS.
Finally, I successfully imported all the projects.
But my git can not fetch from remote from STS, I will fix that later.
4. Creating a User for the Database
Enter the mysql on my local machine
>mysql -uroot -p
mysql>create database sample;
mysql>grant all on sample.* to "username"@"localhost" identified by "111111";
mysql>exit;
Then login to the mysql with the newly created user and password.
>mysql -uusername -p111111
5.Upgrading Current Grails Application
upgrade all the grails project
6. Refresh Dependencies
7. Debugging
In STS, choose Debug Configurations ---> Create new in Grails and grails command
---> -DServer.port=9090 run-app
9. Creating Virtual Host
>vi /etc/hosts
Modify and find the virtual machine.
Part 3 Some Tips from Documents
2.6 Convention over Configuration
2.7 Running an Application
>grails -Dserver.port=9090 run-app
3. Configuration
3.1.3 GORM
3.7.2 Dependency Repositories
repositories {
mavenCentral()
ebr()
mavenRepo "http://repository.some.org"
}
Local Directory
repositories {
flatDir name:'myRepo', dirs: '/path/to/repo'
}
Local Maven repository ~/.m2/repository
repositories{
mavenLocal()
}
4. The Command Line
5. Object Relational Mapping(GORM)
Part 4 Groovy Review
Open groovy console
>groovyconsole
println "hello, Carl"
type <CTRL + R>
x = 1
println x
x = new java.util.Date()
println x
It seems that we do not have type for variables. So we can assign different value to them.
Lists and Maps
Built-in support for 2 data types, list for ordered collections of data.
myList = [12,-1,33,0]
println myList[1]
println myList.size()
Map is unordered collections
scores = ['carl': 168, 'kiko': 199]
println scores
println scores['carl'] //168
println scores.kiko //199
And we can easily adding one product to map scores
scores['peter'] = 1000
println scores.peter
Empty the map
emptyMap = [:]
emptyList = []
Closures
square = { it * it}
println square(9) // 81
newList = [1,3,4,5].collect(square)
println newList // [1, 9, 16, 25]
By default closures take 1 parameter called "it". A closure for map.
printMap = {key, value -> println key + "=" + value }
['carl': 168, 'kiko': 199].each(printMap)
//carl=168
//kiko=199
Part 5 Error Messages
I had error message when I tried to fetch the source codes from github in STS.
Error Messages:
https://github.com/name/project: https://github.com/name/project/info/refs?service=git-upload-pack not found
Solution:
Then I go to the STS and git clone the project in Git Repository Exploring, that works.
References:
http://grails.org/doc/1.3.7/guide/2.%20Getting%20Started.html#2.1 Downloading and Installing
http://grails.org/doc/1.3.7/
http://grails.org/doc/1.3.7/guide/3.%20Configuration.html
http://sillycat.iteye.com/blog/830627
http://sillycat.iteye.com/blog/830631
http://groovy.codehaus.org/Getting+Started+Guide
发表评论
-
NodeJS12 and Zlib
2020-04-01 07:44 476NodeJS12 and Zlib It works as ... -
Traefik 2020(1)Introduction and Installation
2020-03-29 13:52 337Traefik 2020(1)Introduction and ... -
Private Registry 2020(1)No auth in registry Nginx AUTH for UI
2020-03-18 00:56 436Private Registry 2020(1)No auth ... -
Buffer in NodeJS 12 and NodeJS 8
2020-02-25 06:43 385Buffer in NodeJS 12 and NodeJS ... -
NodeJS ENV Similar to JENV and PyENV
2020-02-25 05:14 478NodeJS ENV Similar to JENV and ... -
Prometheus HA 2020(3)AlertManager Cluster
2020-02-24 01:47 423Prometheus HA 2020(3)AlertManag ... -
Serverless with NodeJS and TencentCloud 2020(5)CRON and Settings
2020-02-24 01:46 337Serverless with NodeJS and Tenc ... -
GraphQL 2019(3)Connect to MySQL
2020-02-24 01:48 247GraphQL 2019(3)Connect to MySQL ... -
GraphQL 2019(2)GraphQL and Deploy to Tencent Cloud
2020-02-24 01:48 451GraphQL 2019(2)GraphQL and Depl ... -
GraphQL 2019(1)Apollo Basic
2020-02-19 01:36 328GraphQL 2019(1)Apollo Basic Cl ... -
Serverless with NodeJS and TencentCloud 2020(4)Multiple Handlers and Running wit
2020-02-19 01:19 314Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(3)Build Tree and Traverse Tree
2020-02-19 01:19 318Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(2)Trigger SCF in SCF
2020-02-19 01:18 294Serverless with NodeJS and Tenc ... -
Serverless with NodeJS and TencentCloud 2020(1)Running with Component
2020-02-19 01:17 312Serverless with NodeJS and Tenc ... -
NodeJS MySQL Library and npmjs
2020-02-07 06:21 288NodeJS MySQL Library and npmjs ... -
Python Library 2019(1)requests and aiohttp
2019-12-18 01:12 261Python Library 2019(1)requests ... -
NodeJS Installation 2019
2019-10-20 02:57 573NodeJS Installation 2019 Insta ... -
Monitor Tool 2019(2)Monit on Multiple Instances and Email Alerts
2019-10-18 10:57 265Monitor Tool 2019(2)Monit on Mu ... -
Sqlite Database 2019(1)Sqlite3 Installation and Docker phpsqliteadmin
2019-09-05 11:24 368Sqlite Database 2019(1)Sqlite3 ... -
Supervisor 2019(2)Ubuntu and Multiple Services
2019-08-19 10:53 370Supervisor 2019(2)Ubuntu and Mu ...
相关推荐
**Grails 框架详解** Grails 是一个基于 Groovy 语言的开源Web应用程序框架,它构建在Java平台之上,旨在简化开发过程并提高生产力。Grails 的设计深受Ruby on Rails的影响,提供了MVC(模型-视图-控制器)架构模式...
《Grails权威指南》是一本全面深入探讨Grails框架的专著,旨在帮助读者掌握这一强大的Web开发工具。Grails是一种基于Groovy语言的开源框架,它为构建现代、高效的应用程序提供了简洁高效的解决方案。本指南针对不同...
- 新建一个系统变量,变量名为`GRAILS_HOME`,变量值为你解压Grails的位置(例如`D:\D\MY_DEV\grails`)。 - 将`%GRAILS_HOME%\bin`路径添加到系统的`PATH`环境变量中。 如果你只打算进行Grails开发,那么可以...
【Grails项目搭建详解】 Grails是一个基于Groovy语言的开源Web应用框架,它简化了开发过程,尤其适合快速构建动态网站。在Eclipse中搭建Grails项目可能相对复杂,但通过以下步骤,即使是初学者也能顺利进行。 1. *...
《Grails用户手册》 Grails,作为一个基于Groovy语言的开源Web应用框架,深受开发者喜爱,它简化了Java开发的复杂性,提供了强大的MVC(Model-View-Controller)架构,以及丰富的插件系统。这份用户手册将帮助你...
对于Grails开发,我们需要的是Eclipse中的Grails插件,它能够提供对Grails项目的创建、运行、调试等一系列功能。 **Grails**是基于Groovy语言的全栈式Web开发框架,它借鉴了Ruby on Rails的设计理念,提供了快速...
### Grails 快速开发 Web 应用程序 #### 一、Grails 概述 Grails 是一种基于 Groovy 的开源应用框架,用于简化 Web 应用程序的开发过程。它采用约定优于配置的原则,这使得开发者可以更快地创建功能丰富的 Web ...
Grails是一个基于Groovy语言的全栈框架,它遵循约定优于配置的原则,并且紧密集成Spring和Hibernate等流行的Java库,简化了开发流程。Grails在IT行业中尤其受到重视,因为它能够帮助开发者快速搭建并部署基于MVC模式...
《Grails 中文参考手册》是一本全面介绍Grails框架的指南,旨在帮助开发者快速上手并深入理解Grails的各个核心概念和技术。Grails是一个基于Groovy语言的开源Web应用框架,它提供了高效的开发环境和强大的功能,使得...
### Groovy和Grails配置方法 #### 一、Groovy与Grails简介 Groovy是一种强大的面向对象编程语言,它运行在Java平台上,并且能够直接与Java代码进行交互。Groovy支持函数式编程特性,拥有丰富的语法糖以及简洁的...
《Grails 2.4.4 框架深度解析》 Grails 2.4.4 是一个基于Java的开源Web应用框架,它利用Groovy语言的强大特性,为开发者提供了一种高效、灵活的开发环境。这个压缩包“grails-2.4.4.zip”包含了完整的Grails 2.4.4...
**Grails 概述** Grails 是一个基于 Groovy 语言的开源 web 应用程序框架,它构建在 Java 平台上,旨在提高开发效率,简化常见 Web 开发任务。Grails 遵循 Model-View-Controller (MVC) 架构模式,允许开发者快速...
《Grails中文参考手册》是针对Groovy编程语言构建的Web应用框架——Grails的一份详尽学习资料。Grails以其高效、灵活和强大的特性,成为开发人员在Java平台上构建Web应用的热门选择。这份手册旨在帮助初学者快速上手...
通过`Config.groovy`文件,开发者可以定义全局配置,而`grails-app/conf/Environment`下的环境特定配置文件则允许针对特定环境进行定制。 9. **命令行工具** Grails提供了一系列命令行工具,如`grails create-app`...
Eclipse 插件 Grails(Groovy)是一个强大的开发工具,它使得在Eclipse环境中进行Groovy和Grails应用的开发变得更为便捷。Groovy是一种动态、面向对象的编程语言,而Grails则是一个基于Groovy的开源Web应用框架,...
**Grails登录系统详解** Grails是一个基于Java的开源Web应用程序框架,它使用Groovy语言进行开发,提供了高效、简洁的编程模型。在Grails中实现用户登录功能是构建任何Web应用的基础,它确保了数据的安全性和用户...
### Grails入门指南知识点 #### 一、Grails框架简介 - **背景**: Grails是一个基于Groovy语言的开源Web应用框架,适用于Java平台。它旨在简化开发过程,提高开发效率,尤其受到那些希望保留Java环境同时寻求更高效...