Package org.apache.maven.profiles

Examples of org.apache.maven.profiles.DefaultProfileManager


        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() );
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

        for ( MavenProject project : projects )
        {
            descriptionBuffer.append( "Listing Profiles for Project: " ).append( project.getId() ).append( "\n" );

            DefaultProfileManager pm =
                new DefaultProfileManager( session.getContainer(), session.getExecutionProperties() );

            // Obtain Profiles from external profiles.xml
            try
            {
                loadProjectExternalProfiles( pm, project.getBasedir() );
            }
            catch ( ProfileActivationException e )
            {
                throw new MojoExecutionException( "Error obtaining external Profiles:" + e.getMessage(), e );
            }

            // Attempt to obtain settings profiles
            loadSettingsProfiles( pm, session.getSettings() );

            // Attempt to obtain profiles from pom.xml
            loadProjectPomProfiles( pm, project );

            // now display
            if ( null == pm.getExplicitlyActivatedIds() || pm.getExplicitlyActivatedIds().size() == 0 )
            {
                if ( getLog().isWarnEnabled() )
                {
                    getLog().warn( "No profiles detected!" );
                }
            }
            else
            {
                // This feels more like a hack to filter out inactive profiles, there is no 'direct'
                // way to query activation status on a Profile instance.
                @SuppressWarnings( "unchecked" )
                Map<String, Profile> allProfilesByIds = pm.getProfilesById();

                // active Profiles will be a subset of *all* profiles
                @SuppressWarnings( "unchecked" )
                List<Profile> activeProfiles = project.getActiveProfiles();
                for ( Profile activeProfile : activeProfiles )
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

                                              new DefaultRepositoryLayout() );
    }

    private ProfileManager getProfileManager( Settings settings )
    {
        return new DefaultProfileManager( container, settings );
    }
View Full Code Here

    private ProfileManager getProfileManager( Settings settings )
    {
        if ( profileManager == null )
        {
            profileManager = new DefaultProfileManager( container, settings );
        }

        return profileManager;
    }
View Full Code Here

        {
            String location = newFile( System.getProperty( "user.home" ), ".m2", "repository" ).getAbsolutePath();
            settings.setLocalRepository( location );
        }

        profileManager = new DefaultProfileManager( getContainer(), getSettings(), System.getProperties() );

        WagonManager wagonManager = (WagonManager) lookup( WagonManager.ROLE );
        wagonManager.setDownloadMonitor( new AntDownloadMonitor() );
        if ( settings.isOffline() )
        {
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

TOP

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

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.