Package org.apache.maven.werkz

Examples of org.apache.maven.werkz.WerkzProject


            goals.add( "build:end" );
        }

        transientMapper.merge( mapper );

        WerkzProject werkzProject = new WerkzProject();
        baseContext.setWerkzProject( werkzProject );

        Set pluginSet = new HashSet();
        // poor mans stack - only pop when you finish the same frame that the plugin was lazily init in
        Set oldDelayedPops = new HashSet( delayedPops );
        delayedPops.clear();

        Thread.currentThread().setContextClassLoader( null );

        try
        {
            runScript( driverHousing, baseContext );
            transientMapper.addResolvedPlugins( Collections.singletonList( driverHousing ) );

            // Dependencies must be processed after the driver is run for compatibility
            // FIXME: From attainGoals angle, how does it know the project needs to
            //        to be verified, or that the project object hasn't been used before
            project.verifyDependencies();
            processDependencies( project );

            for ( Iterator j = projectHousings.iterator(); j.hasNext(); )
            {
                JellyScriptHousing housing = (JellyScriptHousing) j.next();
                runScript( housing, baseContext );
            }
            transientMapper.addResolvedPlugins( projectHousings );

            // Plugin Jelly scripts
            for ( Iterator i = goals.iterator(); i.hasNext(); )
            {
                String goalName = (String) i.next();

                pluginSet.addAll( prepAttainGoal( goalName, baseContext, transientMapper ) );
            }

            // Plugin Jelly scripts
            for ( Iterator i = goals.iterator(); i.hasNext(); )
            {
                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 );
View Full Code Here


     * then run all the current targets
     */
    public void doTag( final XMLOutput output )
        throws JellyTagException
    {
        WerkzProject project = getProject();

        if ( project == null )
        {
            throw new JellyTagException( "No Project available" );
        }

        invokeBody( output );

        try
        {
            // Lazy goal loading
            Session session = createSession();
            MavenJellyContext baseContext = (MavenJellyContext) session.getAttribute( PluginManager.BASE_CONTEXT );
            GoalToJellyScriptHousingMapper mapper = (GoalToJellyScriptHousingMapper) session
                .getAttribute( PluginManager.GOAL_MAPPER );
            PluginManager pluginManager = (PluginManager) session.getAttribute( PluginManager.PLUGIN_MANAGER );

            Set pluginSet;
            try
            {
                pluginSet = pluginManager.prepAttainGoal( getName(), baseContext, mapper );
            }
            catch ( Exception e )
            {
                throw new JellyTagException( e );
            }
            project.attainGoal( getName(), session );
            pluginManager.addDelayedPops( pluginSet );
        }
        catch ( UnattainableGoalException e )
        {
            Throwable root = e.getRootCause();
View Full Code Here

        {
            // we may be invoked inside a child script, so lets try find the parent project
            project = (WerkzProject) context.findVariable( "org.apache.commons.jelly.werkz.Project" );
            if ( project == null )
            {
                project = new WerkzProject();
                context.setVariable( "org.apache.commons.jelly.werkz.Project", project );
            }
        }
        return project;
    }
View Full Code Here

     throws a JellyExceptoin if the goal could not be found
     */
    protected Goal getGoal( String name )
        throws JellyTagException
    {
        WerkzProject project = getProject();
        if ( project == null )
        {
            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

    /**
     * @return the goal manager instance
     */
    protected WerkzProject getProject()
    {
        WerkzProject answer = null;
        ProjectTag tag = (ProjectTag) findAncestorWithClass( ProjectTag.class );
        if ( tag != null )
        {
            answer = tag.getProject();
        }
View Full Code Here

        else
        {
            session = attainTag.getSession();
        }

        WerkzProject project = getProject();

        if ( project == null )
        {
            throw new JellyTagException( "No Project available" );
        }

        invokeBody( output );

        try
        {
            project.attainGoal( getName(), session );
        }
        catch ( UnattainableGoalException e )
        {
            Throwable root = e.getRootCause();
View Full Code Here

            return;
        }

        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 )
        {
            doItAll = null;
            wproject = new WerkzProject();
            // We want to get the right exception
            throw e;
        }
    }
View Full Code Here

            return;
        }

        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 )
        {
            doItAll = null;
            wproject = new WerkzProject();
            // We want to get the right exception
            throw e;
        }
    }
View Full Code Here

     * then run all the current targets
     */
    public void doTag( final XMLOutput output )
        throws JellyTagException
    {
        WerkzProject project = getProject();

        if ( project == null )
        {
            throw new JellyTagException( "No Project available" );
        }

        invokeBody( output );

        try
        {
            // Lazy goal loading
            Session session = createSession();
            MavenJellyContext baseContext = (MavenJellyContext) session.getAttribute( PluginManager.BASE_CONTEXT );
            GoalToJellyScriptHousingMapper mapper = (GoalToJellyScriptHousingMapper) session
                .getAttribute( PluginManager.GOAL_MAPPER );
            PluginManager pluginManager = (PluginManager) session.getAttribute( PluginManager.PLUGIN_MANAGER );

            Set pluginSet;
            try
            {
                pluginSet = pluginManager.prepAttainGoal( getName(), baseContext, mapper );
            }
            catch ( Exception e )
            {
                throw new JellyTagException( e );
            }
            project.attainGoal( getName(), session );
            pluginManager.addDelayedPops( pluginSet );
        }
        catch ( UnattainableGoalException e )
        {
            Throwable root = e.getRootCause();
View Full Code Here

        {
            // we may be invoked inside a child script, so lets try find the parent project
            project = (WerkzProject) context.findVariable( "org.apache.commons.jelly.werkz.Project" );
            if ( project == null )
            {
                project = new WerkzProject();
                context.setVariable( "org.apache.commons.jelly.werkz.Project", project );
            }
        }
        return project;
    }
View Full Code Here

TOP

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

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.