Package org.apache.maven.profiles

Examples of org.apache.maven.profiles.ProfileManager


            projectDir = projectDescriptor.getAbsoluteFile().getParentFile();
        }

        Model superModel = getSuperModel();

        ProfileManager externalProfileManager = config.getGlobalProfileManager();
        ProfileManager superProjectProfileManager;
        if ( externalProfileManager != null )
        {
            superProjectProfileManager = new DefaultProfileManager(
                                                                    container,
                                                                    externalProfileManager.getRequestProperties() );
        }
        else
        {
            superProjectProfileManager = new DefaultProfileManager( container );
        }

        List activeProfiles;

        superProjectProfileManager.addProfiles( superModel.getProfiles() );

        activeProfiles = injectActiveProfiles( superProjectProfileManager, superModel );

        MavenProject superProject = new MavenProject( superModel );
View Full Code Here


        if ( activeProfiles == null )
        {
            activeProfiles = new ArrayList();
        }

        ProfileManager profileMgr = config == null ? null : config.getGlobalProfileManager();

        List injectedProfiles = injectActiveProfiles( profileMgr, model );

        activeProfiles.addAll( injectedProfiles );
       
View Full Code Here

        if ( projectDescriptor != null )
        {
            projectDir = projectDescriptor.getAbsoluteFile().getParentFile();
        }

        ProfileManager externalProfileManager = config.getGlobalProfileManager();
        ProfileManager profileManager;
        if ( externalProfileManager != null )
        {
            profileManager = new DefaultProfileManager( container, externalProfileManager.getRequestProperties() );
        }
        else
        {
            //TODO mkleint - use the (Container, Properties constructor to make system properties embeddable
            profileManager = new DefaultProfileManager( container );
        }

        if ( externalProfileManager != null )
        {
            profileManager.explicitlyActivate( externalProfileManager.getExplicitlyActivatedIds() );

            profileManager.explicitlyDeactivate( externalProfileManager.getExplicitlyDeactivatedIds() );
        }

        List activeProfiles;

        try
        {
            profileManager.addProfiles( model.getProfiles() );

            loadProjectExternalProfiles( profileManager, projectDir );

            activeProfiles = injectActiveProfiles( profileManager, model );
        }
View Full Code Here

            if ( log.isDebugEnabled() )
            {
                writeSettings( settings );
            }

            ProfileManager profileManager = new DefaultProfileManager( container, settings );

            project = projectBuilder.build( file, getLocalRepository(), profileManager, true);

            if ( log.isDebugEnabled() )
            {
View Full Code Here

                    // Ideally, we could use Warn across the board
                    loggerManager.setThreshold( Logger.LEVEL_ERROR );
                    // TODO:Additionally, we can't change the mojo level because the component key includes the version and it isn't known ahead of time. This seems worth changing.
                }

                ProfileManager profileManager = new DefaultProfileManager( embedder.getContainer(), executionProperties );

                if ( commandLine.hasOption( CLIManager.ACTIVATE_PROFILES ) )
                {
                    String [] profileOptionValues = commandLine.getOptionValues( CLIManager.ACTIVATE_PROFILES );

                    if ( profileOptionValues != null )
                    {
                        for ( int i=0; i < profileOptionValues.length; ++i )
                        {
                            StringTokenizer profileTokens = new StringTokenizer( profileOptionValues[i], "," );

                            while ( profileTokens.hasMoreTokens() )
                            {
                                String profileAction = profileTokens.nextToken().trim();

                                if ( profileAction.startsWith( "-" ) || profileAction.startsWith( "!" ) )
                                {
                                    profileManager.explicitlyDeactivate( profileAction.substring( 1 ) );
                                }
                                else if ( profileAction.startsWith( "+" ) )
                                {
                                    profileManager.explicitlyActivate( profileAction.substring( 1 ) );
                                }
                                else
                                {
                                    profileManager.explicitlyActivate( profileAction );
                                }
                            }
                        }
                    }
                }
View Full Code Here

        request.setLocalRepository( configuration.getLocalRepository() );
        request.setBuildStartTime( configuration.getBuildStartTime() );
        request.setUserProperties( configuration.getUserProperties() );
        request.setSystemProperties( configuration.getExecutionProperties() );

        ProfileManager profileManager = configuration.getGlobalProfileManager();
        if ( profileManager != null )
        {
            request.setActiveProfileIds( profileManager.getExplicitlyActivatedIds() );
            request.setInactiveProfileIds( profileManager.getExplicitlyDeactivatedIds() );
        }
        else
        {
            /*
             * MNG-4900: Hack to workaround deficiency of legacy API which makes it impossible for plugins to access the
View Full Code Here

    }

    public void testShouldInjectOneProfileToStandaloneSuperPom()
        throws Exception
    {
        ProfileManager pm = new DefaultProfileManager( getContainer(), new Properties() );

        String profileId = "test-profile";
        String key = "test";
        String value = "value";

        Profile profile = new Profile();
        profile.setId( profileId );
        profile.addProperty( key, value );

        pm.addProfile( profile );
        pm.explicitlyActivate( profileId );

        MavenProject project = projectBuilder.buildStandaloneSuperProject( getLocalRepository(), pm );

        assertEquals( value, project.getProperties().getProperty( key ) );
    }
View Full Code Here

    }

    public void testShouldInjectProfileWithRepositoryToStandaloneSuperPom()
        throws Exception
    {
        ProfileManager pm = new DefaultProfileManager( getContainer(), new Properties() );

        String profileId = "test-profile";
        String repoId = "test-repo";

        Profile profile = new Profile();
        profile.setId( profileId );

        Repository repo = new Repository();
        repo.setId( repoId );
        repo.setUrl( "http://www.google.com" );

        profile.addRepository( repo );

        pm.addProfile( profile );
        pm.explicitlyActivate( profileId );

        MavenProject project = projectBuilder.buildStandaloneSuperProject( getLocalRepository(), pm );

        List repositories = project.getRepositories();
View Full Code Here

        setVariableValueToObject( mojo, "remoteRepositories", mojo.project.getRemoteArtifactRepositories() );

        mojo.execute();

        MavenProjectBuilder builder = (MavenProjectBuilder) lookup( MavenProjectBuilder.ROLE );
        ProfileManager profileManager = new DefaultProfileManager( getContainer(), null, null );

        testMavenProject = builder.buildWithDependencies( pluginXmlFile, mojo.localRepository, profileManager );

        MavenReport reportMojo = (MavenReport) mojo;
        File outputDir = reportMojo.getReportOutputDirectory();
View Full Code Here

        catch ( SettingsConfigurationException e )
        {
            throw new MavenExecutionException( "Unable to configure Maven for execution", e );
        }

        ProfileManager globalProfileManager = request.getGlobalProfileManager();

        globalProfileManager.loadSettingsProfiles( request.getSettings() );

        getLogger().info( "Scanning for projects..." );

        boolean foundProjects = true;
        List projects = getProjects( request );
View Full Code Here

TOP

Related Classes of org.apache.maven.profiles.ProfileManager

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.