Is it possible to use an init.gradle script in IntelliJ Idea?

carlspring :

I'm using the Gradle wrapper in a project in Idead. I have an init.gradle file in a non-standard location and need to find a way to specify it in Idea. I thought this could be done via the Gradle VM options setting field and entered --init-script /path/to/init.gradle in it, but this throws an Unrecognized option --init-gradle /path/to/init.gralde error when trying to re-import the project.

Is there some other way to do this that I'm not aware of?

M.Ricciuti :

You can set Gradle commandline options/arguments from the "Run" configuration panel:

enter image description here

If you set this option on the "Templates>Gradle" panel it will apply to all Gradle tasks invocation ( note that you need to execute tasks with Right-click/Run from the Gradle tool window: double-click will not take the option into account..)

EDIT : another way is to add the commandline options directly in the "Run gradle task" window:

enter image description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=129448&siteId=1