本文整理匯總了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 );
}