Package org.apache.maven.werkz

Examples of org.apache.maven.werkz.Goal


            {
                String goalName = (String) i.next();
                log.debug( "attaining goal " + goalName );
                try
                {
                    Goal goal = werkzProject.getGoal( goalName );
                    if ( goal == null || goal.getAction() == null )
                    {
                        throw new NoSuchGoalException( goalName );
                    }
                    goal.attain( session );
                }
                catch ( NoSuchGoalException e )
                {
                    throw new UnknownGoalException( goalName );
                }
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 );
        log.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 ( log.isDebugEnabled() && !decorators.isEmpty() )
            {
                log.debug( "goal " + g.getName() + " has postGoal decorators " + decorators );
            }
            pluginSet.addAll( decorators );
            decorators = getPreGoalDecorators( g.getName() );
            if ( log.isDebugEnabled() && !decorators.isEmpty() )
            {
                log.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

        throws JellyTagException
    {

        log.debug( "doTag(..):" + name );

        Goal goal = getProject().getGoal( getName(), true );

        goal.setDescription( this.description );
        try
        {
            addPrereqs( goal );
        }
        catch ( CyclicGoalChainException e )
        {
            throw new JellyTagException( e );
        }

        Action action;

        action = getAction();

        if ( action == null )
        {
            action = new DefaultAction()
            {
                public void performAction( Session session )
                    throws Exception
                {
                    performAction();
                }

                public void performAction()
                    throws Exception
                {
                    log.debug( "Running action of target: " + getName() );
                    invokeBody( output );
                }
            };
        }

        goal.setAction( action );
    }
View Full Code Here

        }

        StringTokenizer tokens = new StringTokenizer( getPrereqs(), "," );

        String eachToken = null;
        Goal eachPrereq = null;

        while ( tokens.hasMoreTokens() )
        {
            eachToken = tokens.nextToken().trim();
View Full Code Here

        {
            throw new JellyTagException( "Must use this tag inside a <maven:project> tag" );
        }

        // #### allow lazy creation of callbacks before the goal is defined...
        Goal goal = project.getGoal( name, true );
        if ( goal == null )
        {
            throw new JellyTagException( "No such target name: " + name );
        }
        return goal;
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.