When I use eclipse to run a groovy file, the "run as" only shows two choices which are "Groovy Console" and "Java Application". It should has a "Groovy Script" as default but currently it does not.
To run the file, I have to use "run configurations" to choose the "Groovy Script". Are there any way that I could add "Groovy Script" back to the "run as" list?
If you created your file in Eclipse using the "New" -> "Others" -> "Groovy Type" eclipse generated a class file. The class files cannot be executed as scripts even if they have the .groovy extension.
Try to create a completely new file with .groovy extension with the following content, as example:
println GroovySystem.version
Now the menu "Run as..." -> "Groovy script" is active. The content of your file must be script specific statements in order to get the "Groovy script" menu active.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With