How to run groovy directly as a script without compiling

已回答

I am a newer to IntelliJ idea.

I use IntelliJ to develop some groovy scripts. I noticed that running the groovy script with the default shortcut in IntelliJ will trigger the compile behavior of the groovy script and will run with the Application template. How to set up can make any groovy script use the Groovy template as the default runner, and do not compile the script file. I can manually specify to run with Groovy templates, but there are too many script files, which is very cumbersome.

0

Hello,

Please delete current run configurations, select groovy script, right click -> Run 'script name'.

 

0

Thanks for your help.

But it doesn't work, the groovy script is still running as a Java Appliaction.

Is there a way to mark all groovy scripts to run with the groovy runner and without build?

0

Could you please attach your script example? Isn't it a Groovy class?

0

Umm, I seem to understand what you mean. . . This is my script:


It is a pure groovy class and contains the main method. But I hope that it can be executed directly by GroovyClassLoader just like it is executed on the command line, instead of generating extra .class files on disk.

Like this:

I used to use Eclipse before, and running Groovy class on Eclipse does not trigger compilation behavior.

Thanks for your patience.

0

Hello,

Currently it's not possible. We have similar request on YouTrack: https://youtrack.jetbrains.com/issue/IDEABKL-6795

Feel free to vote for it and leave suggestions in comments

0

请先登录再写评论。