@Override public ProjectReactor bootstrap() { // Don't use session.getTopLevelProject or session.getProjects to keep compatibility with Maven // 2 List<MavenProject> sortedProjects = session.getSortedProjects(); MavenProject topLevelProject = null; for (MavenProject project : sortedProjects) { if (project.isExecutionRoot()) { topLevelProject = project; break; } } if (topLevelProject == null) { throw new IllegalStateException("Maven session does not declare a top level project"); } return new ProjectReactor(mavenProjectConverter.configure(sortedProjects, topLevelProject)); }
public final void execute(Project project, DefaultModuleFileSystem fs, String goal) { if (project.getPom() != null) { TimeProfiler profiler = new TimeProfiler().start("Execute " + goal); ClassLoader currentClassLoader = Thread.currentThread().getContextClassLoader(); try { concreteExecute(project.getPom(), goal); } catch (Exception e) { throw new SonarException("Unable to execute maven plugin", e); } finally { // Reset original ClassLoader that may have been changed during Maven Execution (see // SONAR-1800) Thread.currentThread().setContextClassLoader(currentClassLoader); profiler.stop(); } MavenProjectConverter.synchronizeFileSystem(project.getPom(), fs); } }