JavaProgramPatcher does not work when running Gradle

Answered

If this configuration is used,Cannot add Java parameters in JavaProgramPatcher or RunConfigurationExtension

Need to change the configuration to idea

 

How to work with Gradle and during bootRun execution

0
3 comments

But he doesn't work

 

public class PatchGradleTaskManagerExtension  implements GradleTaskManagerExtension {
    @Override
    public boolean executeTasks(@NotNull ExternalSystemTaskId id, @NotNull List<String> taskNames, @NotNull String projectPath, @Nullable GradleExecutionSettings settings, @Nullable String jvmParametersSetup, @NotNull ExternalSystemTaskNotificationListener listener) throws ExternalSystemException {
        if (settings!=null){
            settings.withVmOptions("-Dtest=a");
        }
        return GradleTaskManagerExtension.super.executeTasks(id, taskNames, projectPath, settings, jvmParametersSetup, listener);
    }

    @Override
    public boolean cancelTask(@NotNull ExternalSystemTaskId externalSystemTaskId, @NotNull ExternalSystemTaskNotificationListener externalSystemTaskNotificationListener) throws ExternalSystemException {
        return false;
    }
}

Cannot pass System.getProperty("test") in the application; obtain

 

I want to add a VM option and class path, how should I do it

0

Sorry there was a misunderstanding. It should work using com.intellij.execution.RunConfigurationExtension extension (see https://github.com/JetBrains/intellij-community/blob/master/plugins/devkit/devkit-core/src/run/DevKitApplicationPatcher.kt as sample), please show your approach if it still doesn't work.

What kind of run configuration do you use?

0

Please sign in to leave a comment.