Source:
public AbstractBuildParticipant getBuildParticipant(final IMavenProjectFacade projectFacade, MojoExecution execution, final IPluginExecutionMetadata executionMetadata) { return new MojoExecutionBuildParticipant(execution, true, false) { @Override public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception { if (appliesToBuildKind(kind)) { final IProject project = projectFacade.getProject(); IMarker[] imarkers = project.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); if (imarkers != null && Arrays.stream(imarkers) .map(m -> m.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO)) .filter(s -> s == IMarker.SEVERITY_ERROR) .findAny() .isPresent()) { return null; } final SubMonitor progress = SubMonitor.convert(monitor, "Executing indexer plugin", 2); final IMaven maven = MavenPlugin.getMaven(); IMavenExecutionContext context = maven.createExecutionContext(); context.getExecutionRequest() .setWorkspaceReader(new IndexerWorkspaceRepository()); final MavenProject mavenProject = getMavenProject(projectFacade, progress.newChild(1)); context.execute(new ICallable<Void>() { @Override public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { maven.execute(mavenProject, getMojoExecution(), monitor); IPath buildDirPath = Path.fromOSString(mavenProject.getBuild() .getDirectory()); IProject project = projectFacade.getProject(); IPath projectPath = project.getLocation(); IPath relativeBuildDirPath = buildDirPath.makeRelativeTo(projectPath); IFolder buildDir = project.getFolder(relativeBuildDirPath); buildDir.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); return null; } }, progress.newChild(1)); } return null; } }; }

Target:
public AbstractBuildParticipant getBuildParticipant(final IMavenProjectFacade projectFacade, MojoExecution execution, final IPluginExecutionMetadata executionMetadata) { return new MojoExecutionBuildParticipant(execution, true, false) { @Override public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception { if (appliesToBuildKind(kind)) { final IProject project = projectFacade.getProject(); IMarker[] imarkers = project.findMarkers(IJavaModelMarker.JAVA_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_INFINITE); if (imarkers != null && Arrays.stream(imarkers) .map(m -> m.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO)) .anyMatch(s -> s == IMarker.SEVERITY_ERROR)) { return null; } final SubMonitor progress = SubMonitor.convert(monitor, "Executing indexer plugin", 2); final IMaven maven = MavenPlugin.getMaven(); IMavenExecutionContext context = maven.createExecutionContext(); context.getExecutionRequest() .setWorkspaceReader(new IndexerWorkspaceRepository()); final MavenProject mavenProject = getMavenProject(projectFacade, progress.newChild(1)); context.execute(new ICallable<Void>() { @Override public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException { maven.execute(mavenProject, getMojoExecution(), monitor); IPath buildDirPath = Path.fromOSString(mavenProject.getBuild() .getDirectory()); IProject project = projectFacade.getProject(); IPath projectPath = project.getLocation(); IPath relativeBuildDirPath = buildDirPath.makeRelativeTo(projectPath); IFolder buildDir = project.getFolder(relativeBuildDirPath); buildDir.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); return null; } }, progress.newChild(1)); } return null; } }; }