To create a Groovy script, do one of the following
Choose New | Groovy script on the context menu of the destination
package. In this case, IntelliJ IDEA creates a file with
the specified name and
groovy extension, and adds a node to the module tree view.
A Groovy class that contains anything but declarations, is perceived as a script. Thus, if you open
a Groovy class in the editor, and type the desired source code, the corresponding file is automatically
converted into a Groovy script, and is marked with the script icon: