首页 > 其他 > 详细

IntelliJ IDEA Groovy(转)

时间:2015-03-27 17:12:25      阅读:472      评论:0      收藏:0      [点我收藏+]

 

更新环境变量:

source /etc/profile

验证是否成功:

# groovy -version
Groovy Version: 2.3.6 JVM: 1.7.0_67 Vendor: Oracle Corporation OS: Linux

打开groovyConsole:

技术分享

 

4)、使用IDE进行开发(这里以Intellij idea 13.1为例)

1. Enable the plugin

Before you create your first Groovy application make sure Groovy plugin is enabled in Settings → Plugins.

技术分享

2. Create a new project

Open Project Wizard and select Scala template. Since Groovy requires Java you have to specify the Project SDK.

技术分享

If you create a Groovy project for the first time IntelliJ IDEA will offer you to create Groovy SDK library. Press Create button and choose directory with a Groovy SDK.

技术分享

The IDE will create an empty project.

技术分享

3. Create a new class

The easiest way to create Groovy class or script is to use Ctrl + N shortcut from Project View or Navigation Bar.

技术分享

Choose between class, interface, enum and annotation with Up and Down arrows.

技术分享

Let‘s create a class with a method returning ‘Hello, world!‘ string.

技术分享

4. Create a new script

Now we can create a script file via Ctrl + N shortcut.

技术分享

Choose between script and GroovyDSL script with Up and Down arrows.

技术分享

Now we can create an instance of our class and invoke hello method.

5. Run the project

In order to run the application you can manually create a Run configuration via Run → Edit configurations or run the active script automatically by pressing Ctrl + Shift + F10 shortcut.

技术分享

 使用Groovy Shell :

打开Tools-->Groovy Shell...

技术分享

使用Groovy Console :

打开Tools-->Groovy Console...

技术分享

 

http://www.it165.net/os/html/201409/9276.html

 

IntelliJ IDEA Groovy(转)

原文:http://www.cnblogs.com/softidea/p/4372038.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!