CompilationStatusListener not working as expected
Answered
Hi, I'm trying to write a basic plugin using gradle-based setup, the plugin includes functionality to perform a certain action on successful completion of the build. Using resources available in the forum and other places, I learnt about the CompilationStatusListener and CompileManager, collated this code.
public class BuildSuccessNotifComponent implements ProjectComponent, CompilationStatusListener {
protected Project _project;
public BuildSuccessNotifComponent(Project project)
{
_project = project;
}
public void initComponent()
{
CompilerManager.getInstance(_project).addCompilationStatusListener(this);
}
@Override
public void compilationFinished(boolean aborted, int errors, int warnings, @NotNull CompileContext compileContext){
if(errors ==0) {
System.out.println("This works!");
}
}
}
I expected the debugger to hit the method breakpoint after a successful build in the test IDE, test build was in IDEA, created a build configuration which was a simple mvn install.
Please sign in to leave a comment.
CompilerManager is for JPS-based builds only, for Gradle please use com.intellij.task.ProjectTaskListener