org.apache.maven.lifecycle.internal.ReactorContext Java Examples
The following examples show how to use
org.apache.maven.lifecycle.internal.ReactorContext.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SmartBuilderImpl.java From takari-smart-builder with Apache License 2.0 | 6 votes |
SmartBuilderImpl(LifecycleModuleBuilder lifecycleModuleBuilder, MavenSession session, ReactorContext reactorContext, TaskSegment taskSegment, Set<MavenProject> projects) { this.lifecycleModuleBuilder = lifecycleModuleBuilder; this.rootSession = session; this.reactorContext = reactorContext; this.taskSegment = taskSegment; this.degreeOfConcurrency = Integer.valueOf(session.getRequest().getDegreeOfConcurrency()); final Comparator<MavenProject> projectComparator = ProjectComparator.create(session); this.reactorBuildQueue = new ReactorBuildQueue(projects, session.getProjectDependencyGraph()); this.executor = new ProjectExecutorService(degreeOfConcurrency, projectComparator); this.stats = ReactorBuildStats.create(projects); }
Example #2
Source File: IncrementalModuleBuilderImpl.java From incremental-module-builder with Apache License 2.0 | 5 votes |
IncrementalModuleBuilderImpl( List<MavenProject> selectedProjects, LifecycleModuleBuilder lifecycleModuleBuilder, MavenSession session, ReactorContext reactorContext, List<TaskSegment> taskSegments ) { this.lifecycleModuleBuilder = Objects.requireNonNull( lifecycleModuleBuilder, "lifecycleModuleBuilder is not allowed to be null." ); this.mavenSession = Objects.requireNonNull( session, "session is not allowed to be null." ); this.taskSegments = Objects.requireNonNull( taskSegments, "taskSegements is not allowed to be null" ); this.reactorContext = Objects.requireNonNull( reactorContext, "reactorContext is not allowed to be null." ); ProjectDependencyGraph projectDependencyGraph = session.getProjectDependencyGraph(); List<MavenProject> intermediateResult = new LinkedList<>(); for ( MavenProject selectedProject : selectedProjects ) { intermediateResult.add( selectedProject ); // Up or downstream ? (-amd) intermediateResult.addAll( projectDependencyGraph.getDownstreamProjects( selectedProject, true ) ); // TODO: Need to think about this? -am ? // intermediateResult.addAll(projectDependencyGraph.getUpstreamProjects(selectedProject, // true)); } List<MavenProject> result = new LinkedList<>(); for ( MavenProject project : intermediateResult ) { if ( !result.contains( project ) ) { result.add( project ); } } this.projects = result; }
Example #3
Source File: GenerateBomMojo.java From sundrio with Apache License 2.0 | 5 votes |
private void build(MavenSession session, MavenProject project, List<MavenProject> allProjects, GoalSet goals) throws MojoExecutionException { session.setProjects(allProjects); ProjectIndex projectIndex = new ProjectIndex(session.getProjects()); try { ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus(new BomDependencyGraph(session.getProjects())); ReactorContext reactorContext = new ReactorContextFactory(new MavenVersion(mavenVersion)).create(session.getResult(), projectIndex, Thread.currentThread().getContextClassLoader(), reactorBuildStatus, builder); List<TaskSegment> segments = segmentCalculator.calculateTaskSegments(session); for (TaskSegment segment : segments) { builder.buildProject(session, reactorContext, project, filterSegment(segment, goals)); } } catch (Throwable t) { throw new MojoExecutionException("Error building generated bom:" + project.getArtifactId(), t); } }
Example #4
Source File: ReactorContextFactory.java From sundrio with Apache License 2.0 | 5 votes |
public ReactorContext create(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status, LifecycleModuleBuilder builder) { ReactorContext context; if (VERSION_3_0_0.compareTo(version) < 0) { throw new UnsupportedOperationException("ReactorContext is not supported in maven version:" + version); } else if (VERSION_3_3_0.compareTo(version) < 0) { context = create_3_2_x(result, index, classLoader, status); } else { context = create_3_3_x(result, index, classLoader, status, builder); } if (context == null) { throw new IllegalStateException("Unable to create ReactorContext"); } return context; }
Example #5
Source File: ReactorContextFactory.java From sundrio with Apache License 2.0 | 5 votes |
private static ReactorContext create_3_2_x(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status) { try { Constructor<ReactorContext> constructor = ReactorContext.class.getDeclaredConstructor(MavenExecutionResult.class, ProjectIndex.class, ClassLoader.class, ReactorBuildStatus.class); return constructor.newInstance(result, index, classLoader, status); } catch (NoSuchMethodException e) { return null; } catch (Throwable t) { throw new RuntimeException("Could not create ReactorContext.", t); } }
Example #6
Source File: ReactorContextFactory.java From sundrio with Apache License 2.0 | 5 votes |
private static ReactorContext create_3_3_x(MavenExecutionResult result, ProjectIndex index, ClassLoader classLoader, ReactorBuildStatus status, LifecycleModuleBuilder builder) { try { Constructor<ReactorContext> constructor = (Constructor<ReactorContext>) ReactorContext.class.getDeclaredConstructors()[0]; return constructor.newInstance(result, index, classLoader, status, Reflections.getMemento(builder)); } catch (Throwable t) { throw new RuntimeException("Could not create ReactorContext.", t); } }