Source:
public AbstractBuildParticipant getBuildParticipant(final IMavenProjectFacade projectFacade, MojoExecution execution, IPluginExecutionMetadata executionMetadata) { return new MojoExecutionBuildParticipant(execution, true, true) { @Override public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception { final Set<IProject> build = super.build(kind, monitor); if (kind == AbstractBuildParticipant2.PRECONFIGURE_BUILD) { return build; } 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 build; } Job job = new WorkspaceJob("Executing " + project.getName() + " jar:jar goal") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 3); execJarMojo(projectFacade, progress.newChild(1, SubMonitor.SUPPRESS_NONE)); MavenProject mvnProject = getMavenProject(projectFacade, progress.newChild(1)); IPath buildDirPath = Path.fromOSString(mvnProject.getBuild() .getDirectory()); IPath projectPath = project.getLocation(); IPath relativeBuildDirPath = buildDirPath.makeRelativeTo(projectPath); IFolder buildDir = project.getFolder(relativeBuildDirPath); if (buildDir != null) { buildDir.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } else { Logger.getLogger(BndConfigurator.class) .logError(String.format("Project build folder '%s' does not exist, or is not a child of the project path '%s'", buildDirPath, projectPath), null); progress.worked(1); } return Status.OK_STATUS; } }; job.setRule(project); job.schedule(); return build; } }; }

Target:
public AbstractBuildParticipant getBuildParticipant(final IMavenProjectFacade projectFacade, MojoExecution execution, IPluginExecutionMetadata executionMetadata) { return new MojoExecutionBuildParticipant(execution, true, true) { @Override public Set<IProject> build(int kind, IProgressMonitor monitor) throws Exception { final Set<IProject> build = super.build(kind, monitor); if (kind == AbstractBuildParticipant2.PRECONFIGURE_BUILD) { return build; } 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 build; } Job job = new WorkspaceJob("Executing " + project.getName() + " jar:jar goal") { @Override public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { SubMonitor progress = SubMonitor.convert(monitor, 3); execJarMojo(projectFacade, progress.newChild(1, SubMonitor.SUPPRESS_NONE)); MavenProject mvnProject = getMavenProject(projectFacade, progress.newChild(1)); IPath buildDirPath = Path.fromOSString(mvnProject.getBuild() .getDirectory()); IPath projectPath = project.getLocation(); IPath relativeBuildDirPath = buildDirPath.makeRelativeTo(projectPath); IFolder buildDir = project.getFolder(relativeBuildDirPath); if (buildDir != null) { buildDir.refreshLocal(IResource.DEPTH_INFINITE, progress.newChild(1)); } else { Logger.getLogger(BndConfigurator.class) .logError(String.format("Project build folder '%s' does not exist, or is not a child of the project path '%s'", buildDirPath, projectPath), null); progress.worked(1); } return Status.OK_STATUS; } }; job.setRule(project); job.schedule(); return build; } }; }