mirror of https://github.com/apache/maven.git
Changed ReactorManager's api for blackList and other methods that require
an 'id' to use MavenProject instead. In some parts of the code a DAG is constructed using a version-less key, and in the api what the id should be is unspecified. This could result in NPE's (it does!) because the code in plexus-utils assumes a known id (vertex in the DAG) is supplied. So, moved the project.getId() calls outside of ReactorManager into the ReactorManager, so that there's just one place where the decision is made on how to generate an id (DAG vertex label) from a project. This centralizes that knowledge for increased maintainability and reduced chances on NPE's. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@279334 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7b6f292c73
commit
69c6305347
|
@ -273,11 +273,11 @@ public class DefaultMaven
|
||||||
|
|
||||||
String id = project.getId();
|
String id = project.getId();
|
||||||
|
|
||||||
if ( rm.hasBuildFailure( id ) )
|
if ( rm.hasBuildFailure( project ) )
|
||||||
{
|
{
|
||||||
logReactorSummaryLine( project.getName(), "FAILED" );
|
logReactorSummaryLine( project.getName(), "FAILED" );
|
||||||
}
|
}
|
||||||
else if ( rm.isBlackListed( id ) )
|
else if ( rm.isBlackListed( project ) )
|
||||||
{
|
{
|
||||||
logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)" );
|
logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,13 @@ public class ReactorManager
|
||||||
return topLevelProject;
|
return topLevelProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void blackList( String id )
|
public void blackList( MavenProject project )
|
||||||
|
{
|
||||||
|
blackList(
|
||||||
|
ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private void blackList( String id )
|
||||||
{
|
{
|
||||||
if ( !blackList.contains( id ) )
|
if ( !blackList.contains( id ) )
|
||||||
{
|
{
|
||||||
|
@ -198,9 +204,10 @@ public class ReactorManager
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isBlackListed( String id )
|
public boolean isBlackListed( MavenProject project )
|
||||||
{
|
{
|
||||||
return blackList.contains( id );
|
return blackList.contains(
|
||||||
|
ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerBuildFailure( MavenProject project, Exception error, String task )
|
public void registerBuildFailure( MavenProject project, Exception error, String task )
|
||||||
|
@ -213,9 +220,9 @@ public class ReactorManager
|
||||||
return !buildFailuresByProject.isEmpty();
|
return !buildFailuresByProject.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasBuildFailure( String id )
|
public boolean hasBuildFailure( MavenProject project )
|
||||||
{
|
{
|
||||||
return buildFailuresByProject.containsKey( id );
|
return buildFailuresByProject.containsKey( project.getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMultipleProjects()
|
public boolean hasMultipleProjects()
|
||||||
|
|
|
@ -177,7 +177,7 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
if ( segment.aggregate() )
|
if ( segment.aggregate() )
|
||||||
{
|
{
|
||||||
if ( !rm.isBlackListed( project.getId() ) )
|
if ( !rm.isBlackListed( project ) )
|
||||||
{
|
{
|
||||||
line();
|
line();
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
MavenProject currentProject = (MavenProject) projectIterator.next();
|
MavenProject currentProject = (MavenProject) projectIterator.next();
|
||||||
|
|
||||||
if ( !rm.isBlackListed( currentProject.getId() ) )
|
if ( !rm.isBlackListed( currentProject ) )
|
||||||
{
|
{
|
||||||
line();
|
line();
|
||||||
|
|
||||||
|
@ -335,8 +335,9 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
rm.registerBuildFailure( project, e, task );
|
rm.registerBuildFailure( project, e, task );
|
||||||
|
|
||||||
rm.blackList( project.getId() );
|
rm.blackList( project );
|
||||||
}
|
}
|
||||||
|
// FIXME: how about the other cases?
|
||||||
}
|
}
|
||||||
|
|
||||||
private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
|
private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
|
||||||
|
|
Loading…
Reference in New Issue