List of usage examples for org.apache.maven.execution ReactorManager ReactorManager
public ReactorManager(List<MavenProject> projects) throws CycleDetectedException, DuplicateProjectException
From source file:org.nuxeo.build.maven.MavenEmbedder.java
License:Open Source License
public void execute(List<MavenProject> projects, List<?> goals, EventMonitor eventMonitor, TransferListener transferListener, Properties properties, File executionRootDirectory) throws CycleDetectedException, LifecycleExecutionException, BuildFailureException, DuplicateProjectException, MissingProjectException { ReactorManager rm = new ReactorManager(projects); EventDispatcher eventDispatcher = new DefaultEventDispatcher(); eventDispatcher.addEventMonitor(eventMonitor); // If this option is set the exception seems to be hidden ... // rm.setFailureBehavior( ReactorManager.FAIL_AT_END ); rm.setFailureBehavior(ReactorManager.FAIL_FAST); MavenSession session = new MavenSession(embedder.getContainer(), settings, localRepository, eventDispatcher, rm, goals, executionRootDirectory.getAbsolutePath(), properties, new Date()); session.setUsingPOMsFromFilesystem(true); if (transferListener != null) { wagonManager.setDownloadMonitor(transferListener); }//from w w w .ja v a 2s . c o m // ---------------------------------------------------------------------- // Maven should not be using system properties internally but because // it does for now I'll just take properties that are handed to me // and set them so that the plugin expression evaluator will work // as expected. // ---------------------------------------------------------------------- if (properties != null) { for (Iterator<?> i = properties.keySet().iterator(); i.hasNext();) { String key = (String) i.next(); String value = properties.getProperty(key); System.setProperty(key, value); } } lifecycleExecutor.execute(session, rm, session.getEventDispatcher()); }
From source file:org.sonar.batch.maven.DefaultMavenPluginExecutor.java
License:Open Source License
public void concreteExecuteMaven2(Method executeMethod, MavenProject pom, String goal) { try {/*w ww.j a va 2s . co m*/ ReactorManager reactor = new ReactorManager(Arrays.asList(pom)); MavenSession clonedSession = new MavenSession(mavenSession.getContainer(), mavenSession.getSettings(), mavenSession.getLocalRepository(), mavenSession.getEventDispatcher(), reactor, Arrays.asList(goal), mavenSession.getExecutionRootDirectory(), mavenSession.getExecutionProperties(), mavenSession.getStartTime()); executeMethod.invoke(lifecycleExecutor, clonedSession, reactor, clonedSession.getEventDispatcher()); } catch (Exception e) { throw new SonarException("Unable to execute Maven 2 plugin", e); } }
From source file:org.sonar.maven.Maven2PluginExecutor.java
License:Open Source License
@Override public void concreteExecute(MavenProject pom, String goal) throws Exception { ReactorManager reactor = new ReactorManager(Arrays.asList(pom)); MavenSession clonedSession = new MavenSession(mavenSession.getContainer(), mavenSession.getSettings(), mavenSession.getLocalRepository(), mavenSession.getEventDispatcher(), reactor, Arrays.asList(goal), mavenSession.getExecutionRootDirectory(), mavenSession.getExecutionProperties(), mavenSession.getStartTime()); lifecycleExecutor.execute(clonedSession, reactor, clonedSession.getEventDispatcher()); }