Source:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { final SubMonitor progress = SubMonitor.convert(monitor); MavenProject project = getMavenProject(facade, progress.newChild(1)); Map<ArtifactKey, String> keysToTypes = new HashMap<>(); for (Artifact a : project.getArtifacts()) { keysToTypes.put(new ArtifactKey(a), a.getType()); } synchronized (pendingJobs) { pendingJobs.remove(facade.getProject()); noMoreEvents = true; } boolean needsBuild = false; for (IResourceChangeEvent event : events) { IResourceDelta delta = event.getDelta(); needsBuild = needsBuild(delta, keysToTypes, facade, progress.newChild(1)); IProject[] refs = facade.getProject() .getReferencedProjects(); for (int i = 0; !needsBuild && i < refs.length; i++) { IMavenProjectFacade pf = MavenPlugin.getMavenProjectRegistry() .getProject(refs[i]); needsBuild = pf != null ? needsBuild(delta, keysToTypes, pf, progress.newChild(1)) : false; } if (needsBuild) { SubMonitor indexMonitor = SubMonitor.convert(monitor, "Rebuilding indexes for project " + facade.getProject() .getName(), 2); List<MojoExecution> list = facade.getMojoExecutions(INDEXER_PLUGIN_GROUP_ID, INDEXER_PLUGIN_ARTIFACT_ID, indexMonitor); if (list.isEmpty()) { indexMonitor.done(); } else { SubMonitor buildMonitor = SubMonitor.convert(monitor, "Rebuilding indexes for project " + facade.getProject() .getName(), list.size()); list.forEach(me -> { try { MavenPlugin.getMaven() .execute(getMavenProject(facade, indexMonitor), me, indexMonitor); } catch (CoreException e) { e.printStackTrace(); } }); } break; } } return Status.OK_STATUS; }

Target:
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { final SubMonitor progress = SubMonitor.convert(monitor); MavenProject project = getMavenProject(facade, progress.newChild(1)); Map<ArtifactKey, String> keysToTypes = new HashMap<>(); for (Artifact a : project.getArtifacts()) { keysToTypes.put(new ArtifactKey(a), a.getType()); } synchronized (pendingJobs) { pendingJobs.remove(facade.getProject()); noMoreEvents = true; } boolean needsBuild = false; for (IResourceChangeEvent event : events) { IResourceDelta delta = event.getDelta(); needsBuild = needsBuild(delta, keysToTypes, facade, progress.newChild(1)); IProject[] refs = facade.getProject() .getReferencedProjects(); for (int i = 0; !needsBuild && i < refs.length; i++) { IMavenProjectFacade pf = MavenPlugin.getMavenProjectRegistry() .getProject(refs[i]); needsBuild = pf != null ? needsBuild(delta, keysToTypes, pf, progress.newChild(1)) : false; } if (needsBuild) { SubMonitor indexMonitor = SubMonitor.convert(monitor, "Rebuilding indexes for project " + facade.getProject() .getName(), 2); List<MojoExecution> list = facade.getMojoExecutions(INDEXER_PLUGIN_GROUP_ID, INDEXER_PLUGIN_ARTIFACT_ID, indexMonitor); if (list.isEmpty()) { indexMonitor.done(); } else { SubMonitor buildMonitor = SubMonitor.convert(monitor, "Rebuilding indexes for project " + facade.getProject() .getName(), list.size()); list.forEach(me -> { try { MavenPlugin.getMaven() .execute(getMavenProject(facade, indexMonitor), me, indexMonitor); } catch (CoreException e) { logger.logError( "An error occurred attempting to build the index for project " + facade.getProject() .getName(), e); } }); } break; } } return Status.OK_STATUS; }