Package org.apache.maven.execution

Examples of org.apache.maven.execution.ProjectDependencyGraph


        try
        {
            ProjectSorter projectSorter = new ProjectSorter( session.getProjects() );

            ProjectDependencyGraph projectDependencyGraph = createDependencyGraph( projectSorter, request );

            session.setProjects( projectDependencyGraph.getSortedProjects() );

            session.setProjectDependencyGraph( projectDependencyGraph );
        }
        catch ( CycleDetectedException e )
        {           
View Full Code Here


    }

    private ProjectDependencyGraph createDependencyGraph( ProjectSorter sorter, MavenExecutionRequest request )
        throws MavenExecutionException
    {
        ProjectDependencyGraph graph = new DefaultProjectDependencyGraph( sorter );

        List<MavenProject> activeProjects = sorter.getSortedProjects();

        activeProjects = trimSelectedProjects( activeProjects, graph, request );
        activeProjects = trimResumedProjects( activeProjects, request );
View Full Code Here

        try
        {
            ProjectSorter projectSorter = new ProjectSorter( session.getProjects() );

            ProjectDependencyGraph projectDependencyGraph = createDependencyGraph( projectSorter, request );

            session.setProjects( projectDependencyGraph.getSortedProjects() );

            session.setProjectDependencyGraph( projectDependencyGraph );
        }
        catch ( CycleDetectedException e )
        {
View Full Code Here

    }

    private ProjectDependencyGraph createDependencyGraph( ProjectSorter sorter, MavenExecutionRequest request )
        throws MavenExecutionException
    {
        ProjectDependencyGraph graph = new DefaultProjectDependencyGraph( sorter );

        Collection<MavenProject> activeProjects = sorter.getSortedProjects();

        File reactorDirectory;
        if ( request.getBaseDirectory() != null )
        {
            reactorDirectory = new File( request.getBaseDirectory() );
        }
        else
        {
            reactorDirectory = null;
        }

        if ( !request.getSelectedProjects().isEmpty() )
        {
            List<MavenProject> selectedProjects = new ArrayList<MavenProject>( request.getSelectedProjects().size() );

            for ( String selectedProject : request.getSelectedProjects() )
            {
                MavenProject project = null;

                for ( MavenProject activeProject : activeProjects )
                {
                    if ( isMatchingProject( activeProject, selectedProject, reactorDirectory ) )
                    {
                        project = activeProject;
                        break;
                    }
                }

                if ( project != null )
                {
                    selectedProjects.add( project );
                }
                else
                {
                    throw new MavenExecutionException( "Could not find the selected project in the reactor: "
                        + selectedProject, request.getPom() );
                }
            }

            activeProjects = selectedProjects;

            boolean makeUpstream = false;
            boolean makeDownstream = false;

            if ( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals( request.getMakeBehavior() ) )
            {
                makeUpstream = true;
            }
            else if ( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals( request.getMakeBehavior() ) )
            {
                makeDownstream = true;
            }
            else if ( MavenExecutionRequest.REACTOR_MAKE_BOTH.equals( request.getMakeBehavior() ) )
            {
                makeUpstream = true;
                makeDownstream = true;
            }
            else if ( StringUtils.isNotEmpty( request.getMakeBehavior() ) )
            {
                throw new MavenExecutionException( "Invalid reactor make behavior: " + request.getMakeBehavior(),
                                                   request.getPom() );
            }

            if ( makeUpstream || makeDownstream )
            {
                activeProjects = new LinkedHashSet<MavenProject>( selectedProjects );

                for ( MavenProject selectedProject : selectedProjects )
                {
                    if ( makeUpstream )
                    {
                        activeProjects.addAll( graph.getUpstreamProjects( selectedProject, true ) );
                    }
                    if ( makeDownstream )
                    {
                        activeProjects.addAll( graph.getDownstreamProjects( selectedProject, true ) );
                    }
                }
            }
        }
View Full Code Here

        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(); )
                {
View Full Code Here

        try
        {
            ProjectSorter projectSorter = new ProjectSorter( session.getProjects() );

            ProjectDependencyGraph projectDependencyGraph = createDependencyGraph( projectSorter, request );

            session.setProjects( projectDependencyGraph.getSortedProjects() );

            session.setProjectDependencyGraph( projectDependencyGraph );
        }
        catch ( CycleDetectedException e )
        {           
View Full Code Here

    }

    private ProjectDependencyGraph createDependencyGraph( ProjectSorter sorter, MavenExecutionRequest request )
        throws MavenExecutionException
    {
        ProjectDependencyGraph graph = new DefaultProjectDependencyGraph( sorter );

        Collection<MavenProject> activeProjects = sorter.getSortedProjects();

        File reactorDirectory;
        if ( request.getBaseDirectory() != null )
        {
            reactorDirectory = new File( request.getBaseDirectory() );
        }
        else
        {
            reactorDirectory = null;
        }

        if ( !request.getSelectedProjects().isEmpty() )
        {
            List<MavenProject> selectedProjects = new ArrayList<MavenProject>( request.getSelectedProjects().size() );

            for ( String selectedProject : request.getSelectedProjects() )
            {
                MavenProject project = null;

                for ( MavenProject activeProject : activeProjects )
                {
                    if ( isMatchingProject( activeProject, selectedProject, reactorDirectory ) )
                    {
                        project = activeProject;
                        break;
                    }
                }

                if ( project != null )
                {
                    selectedProjects.add( project );
                }
                else
                {
                    throw new MavenExecutionException( "Could not find the selected project in the reactor: "
                        + selectedProject, request.getPom() );
                }
            }

            activeProjects = selectedProjects;

            boolean makeUpstream = false;
            boolean makeDownstream = false;

            if ( MavenExecutionRequest.REACTOR_MAKE_UPSTREAM.equals( request.getMakeBehavior() ) )
            {
                makeUpstream = true;
            }
            else if ( MavenExecutionRequest.REACTOR_MAKE_DOWNSTREAM.equals( request.getMakeBehavior() ) )
            {
                makeDownstream = true;
            }
            else if ( MavenExecutionRequest.REACTOR_MAKE_BOTH.equals( request.getMakeBehavior() ) )
            {
                makeUpstream = true;
                makeDownstream = true;
            }
            else if ( StringUtils.isNotEmpty( request.getMakeBehavior() ) )
            {
                throw new MavenExecutionException( "Invalid reactor make behavior: " + request.getMakeBehavior(),
                                                   request.getPom() );
            }

            if ( makeUpstream || makeDownstream )
            {
                activeProjects = new LinkedHashSet<MavenProject>( selectedProjects );

                for ( MavenProject selectedProject : selectedProjects )
                {
                    if ( makeUpstream )
                    {
                        activeProjects.addAll( graph.getUpstreamProjects( selectedProject, true ) );
                    }
                    if ( makeDownstream )
                    {
                        activeProjects.addAll( graph.getDownstreamProjects( selectedProject, true ) );
                    }
                }
            }
        }
View Full Code Here

        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(); )
                {
View Full Code Here

        try
        {
            ProjectSorter projectSorter = new ProjectSorter( session.getProjects() );

            ProjectDependencyGraph projectDependencyGraph = createDependencyGraph( projectSorter, request );

            session.setProjects( projectDependencyGraph.getSortedProjects() );

            session.setProjectDependencyGraph( projectDependencyGraph );
        }
        catch ( CycleDetectedException e )
        {           
View Full Code Here

    }

    private ProjectDependencyGraph createDependencyGraph( ProjectSorter sorter, MavenExecutionRequest request )
        throws MavenExecutionException
    {
        ProjectDependencyGraph graph = new DefaultProjectDependencyGraph( sorter );

        List<MavenProject> activeProjects = sorter.getSortedProjects();

        activeProjects = trimSelectedProjects( activeProjects, graph, request );
        activeProjects = trimResumedProjects( activeProjects, request );
View Full Code Here

TOP

Related Classes of org.apache.maven.execution.ProjectDependencyGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.