本文整理汇总了Java中org.apache.maven.execution.MavenSession.getProjectDependencyGraph方法的典型用法代码示例。如果您正苦于以下问题:Java MavenSession.getProjectDependencyGraph方法的具体用法?Java MavenSession.getProjectDependencyGraph怎么用?Java MavenSession.getProjectDependencyGraph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.maven.execution.MavenSession
的用法示例。
在下文中一共展示了MavenSession.getProjectDependencyGraph方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SmartBuilderImpl
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
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);
}
示例2: IncrementalModuleBuilderImpl
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
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;
}
示例3: logWeavePlan
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
public void logWeavePlan( MavenSession session )
{
if ( !logger.isInfoEnabled() )
{
return;
}
final ProjectDependencyGraph dependencyGraph = session.getProjectDependencyGraph();
logger.info( "=== WEAVE CONCURRENCY BUILD PLAN ======================================" );
for ( MavenProject mavenProject : dependencyGraph.getSortedProjects() )
{
StringBuilder item = new StringBuilder();
item.append( "Project: " );
item.append( mavenProject.getArtifactId() );
final List<MavenProject> upstreamProjects = dependencyGraph.getUpstreamProjects( mavenProject, false );
if ( upstreamProjects.size() > 0 )
{
item.append( " ( " );
for ( Iterator<MavenProject> it = upstreamProjects.iterator(); it.hasNext(); )
{
final MavenProject kid = it.next();
item.append( kid.getArtifactId() );
if ( it.hasNext() )
{
item.append( ", " );
}
}
item.append( ")" );
}
logger.info( item.toString() );
}
logger.info( "=======================================================================" );
}
示例4: runWithCompletionService
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private ProjectBuildList runWithCompletionService( ExecutorService service )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException,
PluginVersionResolutionException, LifecyclePhaseNotFoundException, LifecycleNotFoundException,
ExecutionException, InterruptedException
{
final ClassLoader loader = Thread.currentThread().getContextClassLoader();
try
{
BuildListCalculator buildListCalculator = new BuildListCalculator();
final MavenSession session = ProjectDependencyGraphStub.getMavenSession();
List<TaskSegment> taskSegments = getTaskSegmentCalculator().calculateTaskSegments( session );
ProjectBuildList projectBuildList = buildListCalculator.calculateProjectBuilds( session, taskSegments );
final MojoExecutorStub mojoExecutorStub = new MojoExecutorStub();
final LifecycleWeaveBuilder builder = getWeaveBuilder( mojoExecutorStub );
final ReactorContext buildContext = createBuildContext( session );
ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() );
builder.build( projectBuildList, buildContext, taskSegments, session, service, reactorBuildStatus );
LifecycleExecutionPlanCalculatorStub lifecycleExecutionPlanCalculatorStub =
new LifecycleExecutionPlanCalculatorStub();
final int expected = lifecycleExecutionPlanCalculatorStub.getNumberOfExceutions( projectBuildList );
assertEquals( "All executions should be scheduled", expected, mojoExecutorStub.executions.size() );
return projectBuildList;
}
finally
{
Thread.currentThread().setContextClassLoader( loader );
}
}
示例5: create
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
public static Comparator<MavenProject> create(MavenSession session) {
final ProjectDependencyGraph dependencyGraph = session.getProjectDependencyGraph();
return create0(DependencyGraph.fromMaven(dependencyGraph), ImmutableMap.of(), p -> id(p));
}
示例6: createBuildContext
import org.apache.maven.execution.MavenSession; //导入方法依赖的package包/类
private ReactorContext createBuildContext( MavenSession session )
{
MavenExecutionResult mavenExecutionResult = new DefaultMavenExecutionResult();
ReactorBuildStatus reactorBuildStatus = new ReactorBuildStatus( session.getProjectDependencyGraph() );
return new ReactorContext( mavenExecutionResult, null, null, reactorBuildStatus );
}