Package org.apache.maven.jelly

Examples of org.apache.maven.jelly.MavenJellyContext


        if (lvm == null)
        {
            lvm = new LinkValidatorManager();
            lvm.setExclude(exclude);
            lvm.addLinkValidator(new FileLinkValidator());
            MavenJellyContext ctx;
            if (getProject() == null) {
                LOG.error("maven-linkcheck-plugin: No project set.");
                ctx = new MavenJellyContext();
            } else {
                //System.out.println("Project set:" + getProject());
                ctx = ((Project) getProject()).getContext();
            }
               
            lvm.addLinkValidator(new HTTPLinkValidator(ctx.getProxyHost(), ctx.getProxyPort(), ctx.getProxyUserName(), ctx.getProxyPassword()));
            lvm.addLinkValidator(new MailtoLinkValidator());
            lvm.loadCache(cache);
        }
        return lvm;
    }
View Full Code Here


        this.context = context;
    }

    public void popContext()
    {
        MavenJellyContext context = (MavenJellyContext) contextStack.get( contextStack.size() - 1 );
        contextStack.remove( contextStack.size() - 1 );
        log.debug( "popping off " + this.context + " for " + context + " in " + getId() );
        this.context = context;
    }
View Full Code Here

        return projectHousings;
    }

    MavenJellyContext setupBaseContext( Project project )
    {
        MavenJellyContext prevBaseContext = baseContext;
        baseContext = new MavenJellyContext( mavenSession.getRootContext() );
        baseContext.setInherit( true );
        JellyUtils.populateVariables( baseContext, project.getContext() );
        project.pushContext( baseContext );
        baseContext.setProject( project );
View Full Code Here

     * @todo stop throwing Exception
     */
    public void attainGoals( Project project, List goals )
        throws Exception
    {
        MavenJellyContext prevBaseContext = setupBaseContext( project );

        // Set up the ant project.
        AntProjectBuilder.build( project, baseContext );

        // TODO: shouldn't this be a stack too? Then session attribute not needed
View Full Code Here

         }
         MavenUtils.integrateMapInContext( p, baseContext );
         // but leave alone anything in there that is not a plugin property, and already exists in baseContext
         */
        // TODO necessary to create a new one every time?
        MavenJellyContext pluginContext = new MavenJellyContext( baseContext );
        project.pushContext( pluginContext );
        pluginContext.setInherit( true );
        pluginContext.setVariable( "context", pluginContext );
        pluginContext.setVariable( "plugin", project );
        pluginContext.setVariable( "plugin.dir", housing.getPluginDirectory() );
        pluginContext.setVariable( "plugin.resources", new File( housing.getPluginDirectory(), "plugin-resources" ) );

        log.debug( "initialising plugin housing: " + project );
        runScript( housing, pluginContext );

        return pluginContext;
View Full Code Here

                ForeheadClassLoader pluginClassLoader = (ForeheadClassLoader) cl;
                pluginClassLoader.addURL( jellyScriptHousing.getPluginDirectory().toURL() );
            }
        }

        MavenJellyContext context = jellyScriptHousing.getProject().getContext();
        URL oldRoot = context.getRootURL();
        URL oldCurrent = context.getCurrentURL();

        context.setRootURL( jellyScriptHousing.getSource().toURL() );
        context.setCurrentURL( jellyScriptHousing.getSource().toURL() );

        try
        {
            if ( log.isDebugEnabled() )
            {
                log.debug( "Jelly script to parse : " + jellyScriptHousing.getSource().toURL() );
            }
            Script script = JellyUtils.compileScript( jellyScriptHousing.getSource(), context );

            context.setRootURL( oldRoot );
            context.setCurrentURL( oldCurrent );

            return script;
        }
        catch ( Exception e )
        {
View Full Code Here

                fr = null;
            }
        }

        // 2)
        MavenJellyContext context = MavenUtils.createContextNoDefaults( projectDescriptor.getParentFile(),
                                                                        parentContext );

        // 3)
        String pomToExtend = project.getExtend();

        if ( pomToExtend != null && useParentPom )
        {
            // We must look in the <extend/> element for expressions that may be present as
            //
            // <extend>../project.xml</extend>
            Expression e = JellyUtils.decomposeExpression( pomToExtend, context );
            pomToExtend = e.evaluateAsString( context );
            pomToExtend = MavenUtils.makeAbsolutePath( projectDescriptor.getParentFile(), pomToExtend );
            project.setExtend( pomToExtend );

            File parentPom = new File( pomToExtend );
            parentPom = parentPom.getCanonicalFile();
            if ( !parentPom.exists() )
            {
                throw new FileNotFoundException( "Parent POM not found: " + parentPom );
            }

            String parentPomPath = parentPom.getPath();
            if ( parentPomPath.equals( projectDescriptor.getCanonicalPath() ) )
            {
                throw new MavenException( "Parent POM is equal to the current POM" );
            }

            Project parent = (Project) parentPoms.get( parentPomPath );
            if ( parent == null )
            {
                parent = getNonJellyProject( parentPom, parentContext, true );
                parent.setFile( parentPom );
                parentPoms.put( parentPom.getCanonicalPath(), parent );
                context.setParent( parent.getContext() );
            }

            // Map in the parent context which already has the properties loaded
            integrateMapInContext( parent.getContext().getVariables(), context );

            project.mergeParent( parent );
        }

        project.resolveIds();

        applyDefaults( context );

        // Set the created context, and put the project itself in the context. This
        // is how we get the ${pom} reference in the project.xml file to work.
        project.setContext( context );
        context.setProject( project );

        return project;
    }
View Full Code Here

     */
    private static Project getJellyProject( Project project )
        throws Exception
    {
        // Keep a copy of the original context
        MavenJellyContext originalContext = project.getContext();

        // We don't want any taglib references in the context or Jelly
        // gets confused. All we want are the variables for interpolation. We
        // can change this but I think we would like to avoid general Jelly
        // idiom in the POM anyway.
View Full Code Here

     * @return The generated maven based on the contents of the standard maven
     * properties files.
     */
    public static MavenJellyContext createContext( File descriptorDirectory, MavenJellyContext parentContext )
    {
        MavenJellyContext context = createContextNoDefaults( descriptorDirectory, parentContext );
        applyDefaults( context );
        return context;
    }
View Full Code Here

            userBuildProperties,
            projectBuildProperties,
            projectProperties,
            driverProperties } );

        MavenJellyContext context;

        if ( parentContext != null )
        {
            context = new MavenJellyContext( parentContext );
        }
        else
        {
            context = new MavenJellyContext();
        }

        // Turn off inheritence so parent values are overriden
        context.setInherit( false );

        //integrate everything else...
        MavenUtils.integrateMapInContext( result, context );

        // Turn inheritance back on to make the parent's values visible.
        context.setInherit( true );

        // Set the basedir value in the context.
        context.setVariable( "basedir", descriptorDirectory.getAbsolutePath() );

        return context;
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.jelly.MavenJellyContext

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.