An init script can be specified with -I command-line parameter, and therefore a custom gradlew wrapper script can always call it. But some (including Intellij IDEA) do not support default command line parameters for Gradle, and they seem to ignore gradlew when using the tooling API. But they do allow JVM parameters. An init script passed on -I should just as easily be passed with a -D gradle JVM parameter, easy fix, makes existing IDE’s able to use these immediately.
IntelliJ does support this, but it’s a little goofy. You can add command line options to the default Gradle run configuration in the field marked “Script Parameters”. Note though, that when simply double-clicking a task in the Gradle tool window, the options from the default run configuration aren’t used (I assume this is a bug). You must instead right-click > Run for it to work.
An even better option would be to bundle the necessary init script(s) inside a custom Gradle distribution thereby removing the need for modified wrapper scripts or explicit command line arguments.