Package org.codehaus.plexus.interpolation

Examples of org.codehaus.plexus.interpolation.PropertiesBasedValueSource


        if ( getLogger().isDebugEnabled() )
        {
            getLogger().debug( "properties used " + filterProperties );
        }

        final ValueSource propertiesValueSource = new PropertiesBasedValueSource( filterProperties );

        if ( request != null )
        {
            FileUtils.FilterWrapper wrapper = new Wrapper( request.getDelimiters(), request.getMavenProject(),
                                                           request.getMavenSession(), propertiesValueSource,
View Full Code Here


        final Properties props = new Properties();
        props.putAll(project.getProperties());
        props.putAll(mavenSession.getSystemProperties());
        props.putAll(mavenSession.getUserProperties());
       
        interpolator.addValueSource(new PropertiesBasedValueSource(props));

        // add ${project.foo}
        interpolator.addValueSource(new PrefixedObjectValueSource(Arrays.asList("project", "pom"), project, true));

        // add ${session.foo}
View Full Code Here

            specialExpressionOverrides.setProperty( "finalName", finalName );
            specialExpressionOverrides.setProperty( "build.finalName", finalName );
        }

        // 1
        interpolator.addValueSource( new PropertiesBasedValueSource( specialExpressionOverrides ) );

        if ( moduleProject != null )
        {
            // 2
            interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject ) );
            interpolator.addValueSource( new PrefixedPropertiesValueSource( "module.properties.",
                                                                            moduleProject.getProperties() ) );
            if ( moduleProject.getArtifact() != null )
            {
                interpolator.addValueSource( new PrefixedObjectValueSource( "module.", moduleProject.getArtifact() ) );
            }
        }

        if ( artifactProject != null )
        {
            // 3
            interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject ) );
            interpolator.addValueSource( new PrefixedPropertiesValueSource( "artifact.properties.",
                                                                            artifactProject.getProperties() ) );
            if ( artifactProject.getArtifact() != null )
            {
                interpolator.addValueSource( new PrefixedObjectValueSource( "artifact.", artifactProject.getArtifact() ) );
            }
        }

        MavenSession session = null;

        if ( configSource != null )
        {
            session = configSource.getMavenSession();

            if ( session != null )
            {
                Properties userProperties = null;
                try
                {
                    userProperties = session.getExecutionProperties();
                }
                catch ( final NoSuchMethodError nsmer )
                {
                    // OK, so user is using Maven <= 2.0.8. No big deal.
                }

                if ( userProperties != null )
                {
                    // 4
                    interpolator.addValueSource( new PropertiesBasedValueSource( userProperties ) );
                }
            }
        }

        if ( mainProject != null )
        {
            // 5
            interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES,
                                                                        mainProject, true ) );

            // 6
            interpolator.addValueSource( new PrefixedPropertiesValueSource(
                                                                            InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
                                                                            mainProject.getProperties(), true ) );
        }

        Properties commandLineProperties = System.getProperties();
        if ( session != null )
        {
            commandLineProperties = new Properties();
            if ( session.getExecutionProperties() != null )
            {
                commandLineProperties.putAll( session.getExecutionProperties() );
            }

            if ( session.getUserProperties() != null )
            {
                commandLineProperties.putAll( session.getUserProperties() );
            }
        }

        // 7
        interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );

        try
        {
            // 8
            interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
View Full Code Here

            specialRules.setProperty( "dashClassifier?", "" );
            specialRules.setProperty( "dashClassifier", "" );
        }

        // 5
        interpolator.addValueSource( new PropertiesBasedValueSource( specialRules ) );

        MavenSession session = null;
        if ( configSource != null )
        {
            session = configSource.getMavenSession();

            if ( session != null )
            {
                Properties userProperties = null;
                try
                {
                    userProperties = session.getExecutionProperties();
                }
                catch ( final NoSuchMethodError nsmer )
                {
                    // OK, so user is using Maven <= 2.0.8. No big deal.
                }

                if ( userProperties != null )
                {
                    // 6
                    interpolator.addValueSource( new PropertiesBasedValueSource( userProperties ) );
                }
            }
        }

        if ( mainProject != null )
        {
            // 7
            interpolator.addValueSource( new PrefixedPropertiesValueSource(
                                                                            InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
                                                                            mainProject.getProperties(), true ) );
        }

        Properties commandLineProperties = System.getProperties();
        if ( session != null )
        {
            commandLineProperties = new Properties();
            if ( session.getExecutionProperties() != null )
            {
                commandLineProperties.putAll( session.getExecutionProperties() );
            }

            if ( session.getUserProperties() != null )
            {
                commandLineProperties.putAll( session.getUserProperties() );
            }
        }

        // 8
        interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );

        try
        {
            // 9
            interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
View Full Code Here

            }

            if ( userProperties != null )
            {
                // 4
                interpolator.addValueSource( new PropertiesBasedValueSource( userProperties ) );
            }
        }

        interpolator.addValueSource( new PrefixedPropertiesValueSource(
                                                                        InterpolationConstants.PROJECT_PROPERTIES_PREFIXES,
                                                                        project.getProperties(), true ) );
        interpolator.addValueSource( new PrefixedObjectValueSource( InterpolationConstants.PROJECT_PREFIXES, project,
                                                                    true ) );

        final Properties settingsProperties = new Properties();
        if ( configSource.getLocalRepository() != null )
        {
            settingsProperties.setProperty( "localRepository", configSource.getLocalRepository().getBasedir() );
            settingsProperties.setProperty( "settings.localRepository", configSource.getLocalRepository().getBasedir() );
        }
        else if ( session != null && session.getSettings() != null )
        {
            settingsProperties.setProperty( "localRepository", session.getSettings().getLocalRepository() );
            settingsProperties.setProperty( "settings.localRepository", configSource.getLocalRepository().getBasedir() );
        }

        interpolator.addValueSource( new PropertiesBasedValueSource( settingsProperties ) );

        Properties commandLineProperties = System.getProperties();
        if ( session != null )
        {
            commandLineProperties = new Properties();
            if ( session.getExecutionProperties() != null )
            {
                commandLineProperties.putAll( session.getExecutionProperties() );
            }
           
            if ( session.getUserProperties() != null )
            {
                commandLineProperties.putAll( session.getUserProperties() );
            }
        }

        // 7
        interpolator.addValueSource( new PropertiesBasedValueSource( commandLineProperties ) );
        interpolator.addValueSource( new PrefixedPropertiesValueSource( Collections.singletonList( "env." ),
                                                                        ENVIRONMENT_VARIABLES, true ) );

        interpolator.addPostProcessor( new PathTranslatingPostProcessor( project.getBasedir() ) );
        return interpolator;
View Full Code Here

                    expressionEngine.setPropertyDelimiter( propertyDelimiter );
                    builder.setExpressionEngine( expressionEngine );

                    StringSearchInterpolator interpolator = new StringSearchInterpolator( "${", "}" );
                    // interpolation as plexus did it before
                    interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );

                    String interpolatedProps = interpolator.interpolate( properties );

                    logger.debug( "Loading configuration into commons-configuration, xml {}", interpolatedProps );
                    builder.load( new StringReader( interpolatedProps ) );
View Full Code Here

            }
            catch ( final IOException e )
            {
            }

            interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );
            interpolator.addValueSource( new PropertiesBasedValueSource( project.getProperties() ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "project", project ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "pom", project ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "settings", settings ) );

            try
View Full Code Here

        if ( getLogger().isDebugEnabled() )
        {
            getLogger().debug( "properties used " + filterProperties );
        }

        final ValueSource propertiesValueSource = new PropertiesBasedValueSource( filterProperties );

        if ( request != null )
        {
            FileUtils.FilterWrapper wrapper =
                new Wrapper( request.getDelimiters(), request.getMavenProject(), request.getMavenSession(),
View Full Code Here

                    expressionEngine.setPropertyDelimiter( propertyDelimiter );
                    builder.setExpressionEngine( expressionEngine );

                    StringSearchInterpolator interpolator = new StringSearchInterpolator( "${", "}" );
                    // interpolation as plexus did it before
                    interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );

                    String interpolatedProps = interpolator.interpolate( properties );

                    logger.debug( "Loading configuration into commons-configuration, xml {}", interpolatedProps );
                    builder.load( new StringReader( interpolatedProps ) );
View Full Code Here

            }
            catch ( final IOException e )
            {
            }

            interpolator.addValueSource( new PropertiesBasedValueSource( System.getProperties() ) );
            interpolator.addValueSource( new PropertiesBasedValueSource( project.getProperties() ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "project", project ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "pom", project ) );
            interpolator.addValueSource( new PrefixedObjectValueSource( "settings", settings ) );

            try
View Full Code Here

TOP

Related Classes of org.codehaus.plexus.interpolation.PropertiesBasedValueSource

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.