play2-maven-plugin/src/main/java/com/google/code/play2/plugin/MavenPlay2Builder.java
private List<MavenProject> calculateProjectsToBuild( Set<String> changedFilePaths )
    {
        Set<MavenProject> changedProjects = new HashSet<MavenProject>( projects.size() );
        for ( String path: changedFilePaths )
        {
            MavenProject p = findProjectFor( path );
            changedProjects.add( p );
        }

        Set<MavenProject> changedAndDependentProjects = new HashSet<MavenProject>( projects.size() );
        for ( MavenProject p: changedProjects )
        {
            changedAndDependentProjects.add( p );
            List<MavenProject> deps = session.getProjectDependencyGraph().getDownstreamProjects( p, true/*transitive*/ );
            for ( MavenProject depP: deps )
            {
                if ( projects.contains( depP ) )
                {
                    changedAndDependentProjects.addAll( deps );
                }
            }
        }

        List<MavenProject> result = new ArrayList<MavenProject>( changedAndDependentProjects.size() );
        for ( MavenProject p: projects )
        {
            if ( changedAndDependentProjects.contains( p ) )
            {
                result.add( p );
            }
        }
        return result;
    }
private List<MavenProject> calculateProjectsToBuild( Set<String> changedFilePaths )
    {
        Set<MavenProject> changedProjects = new HashSet<MavenProject>( projects.size() );
        for ( String path: changedFilePaths )
        {
            MavenProject p = findProjectFor( path );
            changedProjects.add( p );
        }

        Set<MavenProject> changedAndDependentProjects = new HashSet<MavenProject>( projects.size() );
        for ( MavenProject p: changedProjects )
        {
            changedAndDependentProjects.add( p );
            List<MavenProject> deps = session.getProjectDependencyGraph().getDownstreamProjects( p, true/*transitive*/ );
            for ( MavenProject depP: deps )
            {
                if ( projects.contains( depP ) )
                {
                    changedAndDependentProjects.addAll( deps );
                }
            }
        }

        List<MavenProject> result = new ArrayList<MavenProject>( changedAndDependentProjects.size() );
        for ( MavenProject p: projects )
        {
            if ( changedAndDependentProjects.contains( p ) )
            {
                result.add( p );
            }
        }
        return result;
    }
=== TEST ===================================================================================