Package org.apache.maven.werkz

Examples of org.apache.maven.werkz.Goal


        try
        {
            wproject = new WerkzProject();

            doItAll = new Goal( "DO_IT_ALL" );
            doItAll.setAction( new DummyAction() );

            //Initialise all the true goals of the system
            Iterator iter = projects.iterator();
            while ( iter.hasNext() )
            {
                Project project = (Project) iter.next();
                Goal projectGoal = getOrCreateGoal( project, true );
                doItAll.addPrecursor( projectGoal );
            }

            //Now add the dependencies
            iter = projects.iterator();
            while ( iter.hasNext() )
            {
                Project project = (Project) iter.next();
                Goal projectGoal = getExistingGoal( project );

                Iterator depIter = project.getDependencies().iterator();
                while ( depIter.hasNext() )
                {
                    Dependency dep = (Dependency) depIter.next();
                    Project depProject = new Project();
                    depProject.setId( dep.getId() );

                    Goal depGoal = getOrCreateGoal( depProject, false );
                    projectGoal.addPrecursor( depGoal );
                }
            }
        }
        catch ( CyclicGoalChainException e )
View Full Code Here


        Map answer = createMap();

        Iterator iter = getProject().getGoals().iterator();
        while ( iter.hasNext() )
        {
            Goal goal = (Goal) iter.next();
            String name = goal.getName();
            String prefix = name;
            int idx = name.indexOf( ":" );
            if ( idx >= 0 )
            {
                prefix = name.substring( 0, idx );
View Full Code Here

        try
        {
            wproject = new WerkzProject();

            doItAll = new Goal( "DO_IT_ALL" );
            doItAll.setAction( new DummyAction() );

            //Initialise all the true goals of the system
            Iterator iter = projects.iterator();
            while ( iter.hasNext() )
            {
                Project project = (Project) iter.next();
                Goal projectGoal = getOrCreateGoal( project, true );
                doItAll.addPrecursor( projectGoal );
            }

            //Now add the dependencies
            iter = projects.iterator();
            while ( iter.hasNext() )
            {
                Project project = (Project) iter.next();
                Goal projectGoal = getExistingGoal( project );

                Iterator depIter = project.getDependencies().iterator();
                while ( depIter.hasNext() )
                {
                    Dependency dep = (Dependency) depIter.next();
                    Project depProject = new Project();
                    depProject.setId( dep.getId() );

                    Goal depGoal = getOrCreateGoal( depProject, false );
                    projectGoal.addPrecursor( depGoal );
                }
            }
        }
        catch ( CyclicGoalChainException e )
View Full Code Here

     * @throws JellyTagException If an error occurs while executing the tag.
     */
    public void doTag( XMLOutput output )
        throws JellyTagException
    {
        Goal goal = getProject().getGoal( getName() );

        if ( ( goal == null ) || ( goal.getAction() == null ) )
        {
            super.doTag( output );
            goal = getProject().getGoal( getName() );
            JellyScriptHousing currentHousing = (JellyScriptHousing) getContext()
                .getVariable( PluginManager.PLUGIN_HOUSING );
            goal.setAction( new MavenGoalAction( currentHousing ) );
        }
    }
View Full Code Here

            defaultGoalName = mapper.defaultGoalName;
        }

        for ( Iterator i = mapper.goalProject.getGoals().iterator(); i.hasNext(); )
        {
            Goal goal = (Goal) i.next();
            Goal existingGoal = goalProject.getGoal( goal.getName() );
            if ( existingGoal == null )
            {
                goalProject.addGoal( goal );
            }
            else
            {
                for ( Iterator j = goal.getPrecursors().iterator(); j.hasNext(); )
                {
                    existingGoal.addPrecursor( (Goal) j.next() );
                }
                for ( Iterator j = goal.getPostcursors().iterator(); j.hasNext(); )
                {
                    existingGoal.addPostcursor( (Goal) j.next() );
                }
            }
        }
        resolvedPlugins.addAll( mapper.resolvedPlugins );
    }
View Full Code Here

        Goal[] chain = getExecutionChain( goal, goalProject );
        LOGGER.debug( "execution chain: " + Arrays.asList( chain ).toString() );

        for ( int i = 0; i < chain.length; i++ )
        {
            Goal g = chain[i];
            Object plugin = goalPluginMap.get( g.getName() );
            if ( plugin == null )
            {
                throw new NoSuchGoalException( g.getName() );
            }
            pluginSet.add( plugin );
            Collection decorators = getPostGoalDecorators( g.getName() );
            if ( LOGGER.isDebugEnabled() && !decorators.isEmpty() )
            {
                LOGGER.debug( "goal " + g.getName() + " has postGoal decorators " + decorators );
            }
            pluginSet.addAll( decorators );
            decorators = getPreGoalDecorators( g.getName() );
            if ( LOGGER.isDebugEnabled() && !decorators.isEmpty() )
            {
                LOGGER.debug( "goal " + g.getName() + " has preGoal decorators " + decorators );
            }
            pluginSet.addAll( decorators );
        }

        // Done like this as the dynatag plugin dependencies must be first in the list
View Full Code Here

     * @todo [1.0] use werkz beta-11 version instead
     */
    public Goal[] getExecutionChain( String name, WerkzProject project )
        throws NoSuchGoalException
    {
        Goal goal = project.getGoal( name );

        LinkedList chain = new LinkedList();
        LinkedList stack = new LinkedList();

        stack.addLast( goal );

        while ( !stack.isEmpty() )
        {
            goal = (Goal) stack.removeFirst();

            if ( ( goal == null ) || chain.contains( goal ) )
            {
                continue;
            }

            chain.addFirst( goal );

            List precursors = goal.getPrecursors();

            for ( Iterator i = precursors.iterator(); i.hasNext(); )
            {
                Goal eachPrecursor = (Goal) i.next();

                if ( !chain.contains( eachPrecursor ) )
                {
                    stack.addLast( eachPrecursor );
                }
View Full Code Here

    public void addGoal( String name, String prereqs, String description, JellyScriptHousing jellyScriptHousing )
    {
        // We load plugins in order of priority, so don't add goals that already exist.
        if ( !goalPluginMap.containsKey( name ) )
        {
            Goal goal = goalProject.getGoal( name, true );

            goal.setDescription( description );

            goalProject.addGoal( goal );

            // Add to the goal -> plugin map.
            goalPluginMap.put( name, jellyScriptHousing );

            if ( prereqs != null )
            {
                String[] s = StringUtils.split( prereqs, "," );

                for ( int i = 0; i < s.length; i++ )
                {
                    try
                    {
                        Goal prereq = goalProject.getGoal( s[i].trim(), true );
                        goal.addPrecursor( prereq );
                    }
                    catch ( CyclicGoalChainException e )
                    {
                        // do nothing.
View Full Code Here

        return goalPluginMap.keySet();
    }

    String getGoalDescription( String goalName )
    {
        Goal goal = goalProject.getGoal( goalName );
        String goalDescription = ( goal != null ? goal.getDescription() : null );
        if ( goalDescription != null )
        {
            goalDescription = goalDescription.trim();
            if ( "null".equals( goalDescription ) )
            {
View Full Code Here

        Map answer = createMap();

        Iterator iter = getProject().getGoals().iterator();
        while ( iter.hasNext() )
        {
            Goal goal = (Goal) iter.next();
            String name = goal.getName();
            String prefix = name;
            int idx = name.indexOf( ":" );
            if ( idx >= 0 )
            {
                prefix = name.substring( 0, idx );
View Full Code Here

TOP

Related Classes of org.apache.maven.werkz.Goal

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.