@Override public Result<ProjectDependencyGraph> build( MavenSession session ) { try { Result<ProjectDependencyGraph> result = sessionDependencyGraph( session ); if ( result == null ) { final List<MavenProject> projects = getProjectsForMavenReactor( session ); validateProjects( projects ); result = reactorDependencyGraph( session, projects ); } return result; } catch ( final ProjectBuildingException | DuplicateProjectException | MavenExecutionException e ) { return Result.error( Collections.singletonList ( new DefaultModelProblem ( null, null, null, null, 0, 0, e ) ) ); } catch ( final CycleDetectedException e ) { String message = "The projects in the reactor contain a cyclic reference: " + e.getMessage(); ProjectCycleException error = new ProjectCycleException( message, e ); return Result.error( Collections.singletonList( new DefaultModelProblem( null, null, null, null, 0, 0, error ) ) ); } }
/** * We are not allowed to have cycles between roles, this method is to detect and raise a red flag when that happens. * * @param model */ private void validateNoRoleCycles( RedbackRoleModel model ) { try { RoleModelUtils.generateRoleGraph( model ); } catch ( CycleDetectedException e ) { addValidationError( "cycle detected: " + e.getMessage() ); } }
/** * We are not allowed to have cycles between roles, this method is to detect and raise a red flag when that happens. * * @param model */ private void validateNoRoleCycles( RedbackRoleModel model ) { try { RoleModelUtils.generateRoleGraph( model ); } catch ( CycleDetectedException e ) { addValidationError( "cycle detected: " + e.getMessage() ); } }
/** * We are not allowed to have cycles between template either, this method is to detect and * raise a red flag when that happens. Templates are a bit more complex since they have both * child and parent roles, as well as runtime parent and child templates * * the id should be sufficient to test cycles here even though in runtime the id's do not need to be * unique since it is the binding of a namePrefix and a resource that makes them unique * * @param model */ private void validateNoTemplateCycles( RedbackRoleModel model ) { try { RoleModelUtils.generateTemplateGraph( model ); } catch ( CycleDetectedException e ) { addValidationError( "template cycle detected: " + e.getMessage() ); } } }
/** * We are not allowed to have cycles between template either, this method is to detect and * raise a red flag when that happens. Templates are a bit more complex since they have both * child and parent roles, as well as runtime parent and child templates * * the id should be sufficient to test cycles here even though in runtime the id's do not need to be * unique since it is the binding of a namePrefix and a resource that makes them unique * * @param model */ private void validateNoTemplateCycles( RedbackRoleModel model ) { try { RoleModelUtils.generateTemplateGraph( model ); } catch ( CycleDetectedException e ) { addValidationError( "template cycle detected: " + e.getMessage() ); } } }
logger.warn( "Ignore cycle detected in project dependencies: " + e.getMessage() ); logger.warn( "Ignore cycle detected in project parent: " + e.getMessage() );