---
title: "Eclipse下的Groovy开发"
author: "noname365"
date: "2009-05-05T00:07:37Z"
tags: ["Eclipse", "Grails", "Groovy", "Netbeans", "maven"]
slug: "eclipse-groovy"
draft: false
lastmod: "2009-05-05T00:10:30Z"
id: 379278
url: "https://cyhcheng.iteye.com/blog/379278"
---

好长时间没更新博客了，今天没事，写点内容。前段时间选了几个学习方向：groovy/grails、flex、seam、swing框架还有一些山寨版框架，整得自己有些焦头烂额。所以最近决定将主要精力放在Groovy/Grails上，原因主要有以下几点：

1. 相对简单，主要基于Spring、Hibernate、SpringMVC、Sitemesh
2. 开发效率较高，能快速完成小型项目的开发
3. 采用了纯面向对象技术，由Model类开始设计，不同于JRuby的根据数据库脚本的逆向开发模式
4. 本人以前学过一段时间，学习方面不会存在什么大的障碍。
5. 个人比较看好的技术

     在开发工具这块，不管是Eclipse、Netbeans还是IntelliJ IDEA都有插件支持，由于Idea本人没有使用过，仅就前两者而言，个人感觉还是Netbeans好用一些，安装完成后，就可以进行开发，而且也没什么特殊的设置。而Eclipse需要安装插件，有时由于插件的依赖关系及网速的限制，安装插件的时间让人郁闷。

     因为Netbeans下比较简单，另外最近需要和别人合作开发Grails应用，所以选择了Eclipse进行这方面的介绍。

     需要安装的主要插件有：

1. eclipse-jee-ganymede-SR2
2. testng 插件：http://beust.com/eclipse
3. maven 插件：http://subclipse.tigris.org/update\_1.6.x
4. Groovy1.6插件：http://groovy.ifs.hsr.ch/GroovyRefactoring/OfficialUpdateSite/

     安装中碰到的问题

- maven的问题：

出现错误消息：

The Maven Integration requires that Eclipse be running in a JDK, because a number of Maven core plugins are using jars from the JDK.  Please make sure the -vm option in eclipse.ini is pointing to a JDK and verify  that Installed JREs are also using JDK installs.

解决办法，做一个快捷方式：D:\\tools\\eclipse\\eclipse.exe -vm D:\\tools\\jdk1.6.0\_13\\bin\\javaw

 

      由于使用的Groovy的页面文件的扩展名是.gsp，为了进行可视化开发，需要设置其打开方式为JSP开发工具。

      开发中碰到的问题：

- 由于本人习惯所有地方使用UTF-8字符集，在编写Groovy代码时出现错误“expect anything  but "\\n"”：

解决办法：

- 将Groovy文件的默认字符集修改为GBK即可解决上面出现的问题，估计是插件Bug的问题