@Test public void shouldNotFailWithDependencyInReactory() throws EnforcerRuleException, ExpressionEvaluationException { MavenProject mp1 = createProjectParent(); MavenProject mp2 = createProjectChild1( mp1 ); Dependency goodDependency = createDependency( "org.junit", "junit", "2.0" ); List<Dependency> depListMP2 = Arrays.asList( goodDependency ); when( mp2.getDependencies() ).thenReturn( depListMP2 ); MavenProject mp3 = createProjectChild2( mp1 ); Dependency dep1_MP3 = createDependency( "org.apache.commons", "commons-io", "1.0.4" ); List<Dependency> depListMP3 = Arrays.asList( dep1_MP3 ); when( mp3.getDependencies() ).thenReturn( depListMP3 ); List<MavenProject> theList = Arrays.asList( mp1, mp2, mp3 ); setupSortedProjects( theList ); rule.execute( helper ); assertTrue( true ); }
@Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { logger = helper.getLog(); MavenSession session; try { session = (MavenSession) helper.evaluate( "${session}" ); } catch ( ExpressionEvaluationException eee ) { throw new EnforcerRuleException( "Unable to retrieve the MavenSession: ", eee ); } List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects(); if ( sortedProjects != null && !sortedProjects.isEmpty() ) { checkReactor( sortedProjects ); checkParentsInReactor( sortedProjects ); checkMissingParentsInReactor( sortedProjects ); checkParentsPartOfTheReactor( sortedProjects ); if ( !isIgnoreModuleDependencies() ) { checkDependenciesWithinReactor( sortedProjects ); } } }
ReactorModuleConvergence extends AbstractNonCacheableEnforcerRule { @Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { logger = helper.getLog(); MavenSession session; try { session = (MavenSession) helper.evaluate( "${session}" ); } catch ( ExpressionEvaluationException eee ) { throw new EnforcerRuleException( "Unable to retrieve the MavenSession: ", eee ); } List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects(); if ( sortedProjects != null && !sortedProjects.isEmpty() ) { checkReactor( sortedProjects ); checkParentsInReactor( sortedProjects ); checkMissingParentsInReactor( sortedProjects ); checkParentsPartOfTheReactor( sortedProjects ); if ( !isIgnoreModuleDependencies() ) { checkDependenciesWithinReactor( sortedProjects ); } } } }
ReactorModuleConvergence extends AbstractNonCacheableEnforcerRule { @Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { logger = helper.getLog(); MavenSession session; try { session = (MavenSession) helper.evaluate( "${session}" ); } catch ( ExpressionEvaluationException eee ) { throw new EnforcerRuleException( "Unable to retrieve the MavenSession: ", eee ); } List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects(); if ( sortedProjects != null && !sortedProjects.isEmpty() ) { checkReactor( sortedProjects ); checkParentsInReactor( sortedProjects ); checkMissingParentsInReactor( sortedProjects ); checkParentsPartOfTheReactor( sortedProjects ); if ( !isIgnoreModuleDependencies() ) { checkDependenciesWithinReactor( sortedProjects ); } } }  }
ReactorModuleConvergence extends AbstractNonCacheableEnforcerRule { @Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { logger = helper.getLog(); MavenSession session; try { session = (MavenSession) helper.evaluate( "${session}" ); } catch ( ExpressionEvaluationException eee ) { throw new EnforcerRuleException( "Unable to retrieve the MavenSession: ", eee ); } List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects(); if ( sortedProjects != null && !sortedProjects.isEmpty() ) { checkReactor( sortedProjects ); checkParentsInReactor( sortedProjects ); checkMissingParentsInReactor( sortedProjects ); checkParentsPartOfTheReactor( sortedProjects ); if ( !isIgnoreModuleDependencies() ) { checkDependenciesWithinReactor( sortedProjects ); } } }  @Override void execute( EnforcerRuleHelper helper ); boolean isIgnoreModuleDependencies(); void setIgnoreModuleDependencies( boolean ignoreModuleDependencies ); }
ReactorModuleConvergence extends AbstractNonCacheableEnforcerRule { @Override public void execute( EnforcerRuleHelper helper ) throws EnforcerRuleException { logger = helper.getLog(); MavenSession session; try { session = (MavenSession) helper.evaluate( "${session}" ); } catch ( ExpressionEvaluationException eee ) { throw new EnforcerRuleException( "Unable to retrieve the MavenSession: ", eee ); } List<MavenProject> sortedProjects = session.getProjectDependencyGraph().getSortedProjects(); if ( sortedProjects != null && !sortedProjects.isEmpty() ) { checkReactor( sortedProjects ); checkParentsInReactor( sortedProjects ); checkMissingParentsInReactor( sortedProjects ); checkParentsPartOfTheReactor( sortedProjects ); if ( !isIgnoreModuleDependencies() ) { checkDependenciesWithinReactor( sortedProjects ); } } }  @Override void execute( EnforcerRuleHelper helper ); boolean isIgnoreModuleDependencies(); void setIgnoreModuleDependencies( boolean ignoreModuleDependencies );  }