简体   繁体   中英

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!

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'))

Yes you can create intellij config to run your script.

Follow these steps:

1) Edit configuration

在此处输入图片说明

2) Add new Groovy configuration

在此处输入图片说明

3) Browse you script
在此处输入图片说明

4) Run your script
在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM