Trigger the build of the project from plugin

Answered

Hi I’m developing a plugin that needs to compile (build) the project. Right now I’m able to run a configuration, this means that the plugin compiles and run the project, but I need just to compile the project without running it. I found some references about CompilerTask and other objects that seem deprecated. There is a way to trigger the build command from api?

This is the code that I use to run a configuration and force the build:

RunManager instance = RunManager.getInstance(panel.getProject());
List<RunnerAndConfigurationSettings> allSettings = instance.getAllSettings();
RunnerAndConfigurationSettings runnerAndConfigurationSettings = allSettings.get(0);
ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder
.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), runnerAndConfigurationSettings);

if (builder != null)
ExecutionManager.getInstance(panel.getProject()).restartRunProfile(builder.build());
1 comment
Comment actions Permalink

Hi,

Please take a look at com.intellij.task.ProjectTaskManager.

0

Please sign in to leave a comment.