# GradleExecutionHelper has become @ApiStatus.Internal, what's a replacement?

**URL:** <https://platform.jetbrains.com/t/gradleexecutionhelper-has-become-apistatus-internal-whats-a-replacement/1922>\
**Category:** IntelliJ Platform\
**Tags:** plugin-development, gradle\
**Created:** [June 5, 2025, 2:07pm UTC](https://platform.jetbrains.com/t/gradleexecutionhelper-has-become-apistatus-internal-whats-a-replacement/1922 "2025-06-05T14:07:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BoD](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/bod/32/119_2.png) [@BoD](https://platform.jetbrains.com/u/BoD)\
**Post date:** [June 5, 2025, 2:07pm UTC](https://platform.jetbrains.com/t/gradleexecutionhelper-has-become-apistatus-internal-whats-a-replacement/1922/1 "2025-06-05T14:07:29Z")

</div>

Hi!

My plugin uses `GradleExecutionHelper` to execute a few tasks. Now since `252` this class has become `@ApiStatus.Internal`.

The documentation says to use `ExternalSystemUtil#runTask` which is high level. But in my case I need to pass certain arguments to the Gradle connection, for instance `--continuous`, and pass it the correct Java home, per `ExternalSystemApiUtil.getExecutionSettings`.

Is there a public way to do that?

I could certainly just use the low level Gradle Tooling APIs but I can see that `GradleExecutionHelper` does quite a few clever things, like pooling connections, etc. which would be a shame to not benefit from.

Thanks a lot.

---

<div class="post-metadata">

**Author:** ![Sergey.Vorobyov](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/sergey.vorobyov/32/761_2.png) [@Sergey.Vorobyov](https://platform.jetbrains.com/u/Sergey.Vorobyov)\
**Post date:** [June 5, 2025, 10:03pm UTC](https://platform.jetbrains.com/t/gradleexecutionhelper-has-become-apistatus-internal-whats-a-replacement/1922/3 "2025-06-05T22:03:40Z")

</div>

Hello @BoD, which function do you use in the `GradleExecutionHelper`?

The command line argument can be provided using the `ExternalSystemTaskExecutionSettings#setScriptParameters` function.

```auto
TaskExecutionUtil.runTask(
  TaskExecutionSpec.create()
    .withProject(project)
    .withSystemId(GradleConstants.SYSTEM_ID)
    .withSettings(ExternalSystemTaskExecutionSettings().also {
      it.externalSystemIdString = GradleConstants.SYSTEM_ID.id
      it.externalProjectPath = projectPath
      it.taskNames = listOf("myTask")
      it.scriptParamters = "--continuous"
    })
)

```

The main issue with `GradleExecutionHelper` is that it requires proper preconfiguration. For example, the `GradleExecutionHelper#execute` function doesn’t create an output tool window. It can be execute only on the background thread, with prepared Job (ProgressIndicator) in thread context. Also, the `LongRunningOperation` API is fragile. In the previsous Gradle vesions, the `LongRunningOperation#addJvmArguments` replaced all user defined JVM arguments instead of adding. The same issue for system properties and environment variables is present in the new Gradle versions.

---

<div class="post-metadata">

**Author:** ![BoD](https://sea1.discourse-cdn.com/flex001/user_avatar/platform.jetbrains.com/bod/32/119_2.png) [@BoD](https://platform.jetbrains.com/u/BoD)\
**Post date:** [June 6, 2025, 1:31pm UTC](https://platform.jetbrains.com/t/gradleexecutionhelper-has-become-apistatus-internal-whats-a-replacement/1922/4 "2025-06-06T13:31:56Z")

</div>

Thanks a lot for the insights, and the hint about `TaskExecutionUtil`.

I was using `GradleExecutionHelper().execute` that takes a `connection` lambda, on which I either call `run()` or `model()` and `get()`.

In the end, I opted to use the Gradle Tooling API directly (`GradleConnector.newConnector()`). For my use case I need to handle the background thread manually so I think this is OK and seems to work fine.
