Package org.apache.maven.jelly

Examples of org.apache.maven.jelly.MavenJellyContext


        // We will assume here that there might not be a project.xml file present
        // and we will create the root context from the directory gleaned from
        // the user.dir system property.
        File basedir = new File( System.getProperty( "user.dir" ) );
        MavenJellyContext c = MavenUtils.createContext( basedir );
        setRootContext( c );
        c.setXMLOutput( output );

        // This is just a start at this mode - there'll still be some output
        if ( getCli().hasOption( OPT_QUIET ) )
        {
            // A little bit of log4j specifics needed here
View Full Code Here


    public DependencyVerifier( Project project )
    {
        super( project );
        failedDependencies = new ArrayList();
        localRepositoryVerifier = new LocalSettingsVerifier( project );
        MavenJellyContext context = getProject().getContext();

        if ( context.getProxyHost() != null )
        {
            proxyInfo = new ProxyInfo();
            proxyInfo.setHost( context.getProxyHost() );
            try
            {
                proxyInfo.setPort( Integer.valueOf( context.getProxyPort() ).intValue() );
            }
            catch ( NumberFormatException e )
            {
                LOGGER.warn( "Ignoring invalid proxy port: '" + context.getProxyPort() + "'" );
            }
            proxyInfo.setUserName( context.getProxyUserName() );
            proxyInfo.setPassword( context.getProxyPassword() );
            proxyInfo.setNonProxyHosts( (String) context.getVariable( MavenConstants.PROXY_NONPROXYHOSTS ) );
            proxyInfo.setNtlmHost( (String) context.getVariable( MavenConstants.PROXY_NTLM_HOST ) );
            proxyInfo.setNtlmDomain( (String) context.getVariable( MavenConstants.PROXY_NTLM_DOMAIN ) );
        }
        String meterType = (String) context.getVariable( MavenConstants.DOWNLOAD_METER );
        if ( meterType == null )
        {
            meterType = "console";
        }
View Full Code Here

        {
            throw new MavenException( "Error parsing project.xml '" + projectDescriptor.getAbsolutePath() + "'", e );
        }

        // 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

     *             when there are errors reading FIXME
     */
    public 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

     * @todo should premerge driver, etc if they are being kept
     * @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

        Map result =
            MavenUtils.mergeMaps( new Map[] { systemProperties, 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

        this.context = context;
    }

    public void popContext()
    {
        MavenJellyContext context = (MavenJellyContext) contextStack.get( contextStack.size() - 1 );
        contextStack.remove( contextStack.size() - 1 );
        LOGGER.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" ) );

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

        return pluginContext;
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.