RV_Dev
RV_Dev

Reputation: 435

How can I run single groovy class file independently in gradle?

I have 2 groovy class files under one rootProject. I want to run just one of them without running the other one. How can I do that using intellij command line and command prompt. Right now when I run the rootProject both files run one after the other. Is there any setting required build.gradle file then please explain hoow can I do that as I am very new to gradle and don't know much about it. Thanks!

Upvotes: 0

Views: 880

Answers (2)

dsharew
dsharew

Reputation: 10675

Yes you can create intellij config to run your script.

Follow these steps:

1) Edit configuration

enter image description here

2) Add new Groovy configuration

enter image description here

3) Browse you script
enter image description here

4) Run your script
enter image description here

Upvotes: 1

Martin Linha
Martin Linha

Reputation: 1019

If you have only those two groovy scripts (and there is nothing to compile etc.), you do not need Gradle to run it at all. From command line call

groovy <filename>.groovy

To run the script directly from Gradle Script, use

new GroovyShell().run(file('somePath'))

Upvotes: 1

Related Questions