16
votes

I'm currently writing some groovy scripts. Till now I simply use notepad and run the scripts via groovy script.groovy. But I'm looking some help for editing the files. So I tried eclipse with the groovy plugin which looks great...for groovy projects. But I just want to edit and run the groovy scripts. No Project dir etc.. What's the best way to handle scripts in eclipse. I don't want to package the files to jars or something like that. I have just a folder with some scripts in it... No src/bin directory or subfolders for package names. Is that possible?

Thanks, Ingo

3

3 Answers

16
votes

You must convert your project to a Groovy project (right-click project: Configure > Convert to Groovy Project), but then, sure, it's possible.

When editing a .groovy file, select Run > Run as ... > Groovy Script

3
votes

It sounds like Eclipse is a bit heavyweight for your needs, have you considered using the GroovyConsole instead? It's a very simple Groovy IDE, available in the Groovy bin directory. Assuming you have this directory on your PATH, you can start it by running groovyConsole from the command line.

Useful shortcuts are:

  • Ctrl + R : run the script
  • Ctrl + W : clear the output
0
votes

This solution still requires a "project", but aims to use Eclipse to do it in the least invasive way.

http://andrewclement.blogspot.com/2009/12/using-eclipse-to-edit-your-groovy.html#!/2009/12/using-eclipse-to-edit-your-groovy.html

Then you can use the "run as" as stated by Mr. Floyd :D