Package org.apache.maven.model

Examples of org.apache.maven.model.Profile


    */
    public void addProfile( Profile profile )
    {
        String profileId = profile.getId();

        Profile existing = (Profile) profilesById.get( profileId );
        if ( existing != null )
        {
            logger.warn( "Overriding profile: \'" + profileId + "\' (source: " + existing.getSource()
                + ") with new instance from source: " + profile.getSource() );
        }

        profilesById.put( profile.getId(), profile );

View Full Code Here


     */
    public void addProfiles( List profiles )
    {
        for ( Object profile1 : profiles )
        {
            Profile profile = (Profile) profile1;

            addProfile( profile );
        }
    }
View Full Code Here

    {
    }

    public static Profile convertFromProfileXmlProfile( org.apache.maven.profiles.Profile profileXmlProfile )
    {
        Profile profile = new Profile();

        profile.setId( profileXmlProfile.getId() );

        profile.setSource( "profiles.xml" );

        org.apache.maven.profiles.Activation profileActivation = profileXmlProfile.getActivation();

        if ( profileActivation != null )
        {
            Activation activation = new Activation();

            activation.setActiveByDefault( profileActivation.isActiveByDefault() );

            activation.setJdk( profileActivation.getJdk() );

            org.apache.maven.profiles.ActivationProperty profileProp = profileActivation.getProperty();

            if ( profileProp != null )
            {
                ActivationProperty prop = new ActivationProperty();

                prop.setName( profileProp.getName() );
                prop.setValue( profileProp.getValue() );

                activation.setProperty( prop );
            }

           
            ActivationOS profileOs = profileActivation.getOs();
           
            if ( profileOs != null )
            {
                org.apache.maven.model.ActivationOS os = new org.apache.maven.model.ActivationOS();

                os.setArch( profileOs.getArch() );
                os.setFamily( profileOs.getFamily() );
                os.setName( profileOs.getName() );
                os.setVersion( profileOs.getVersion() );

                activation.setOs( os );
            }
           
            org.apache.maven.profiles.ActivationFile profileFile = profileActivation.getFile();

            if ( profileFile != null )
            {
                ActivationFile file = new ActivationFile();

                file.setExists( profileFile.getExists() );
                file.setMissing( profileFile.getMissing() );

                activation.setFile( file );
            }

            profile.setActivation( activation );
        }

        profile.setProperties( profileXmlProfile.getProperties() );

        List repos = profileXmlProfile.getRepositories();
        if ( repos != null )
        {
            for ( Object repo : repos )
            {
                profile.addRepository( convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) repo ) );
            }
        }

        List pluginRepos = profileXmlProfile.getPluginRepositories();
        if ( pluginRepos != null )
        {
            for ( Object pluginRepo : pluginRepos )
            {
                profile.addPluginRepository(
                    convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) pluginRepo ) );
            }
        }

        return profile;
View Full Code Here

            throw new ProjectBuildingException( projectId, "Failed to calculate active external profiles.", e );
        }

        for ( Iterator i = activeExternalProfiles.iterator(); i.hasNext(); )
        {
            Profile externalProfile = (Profile) i.next();

            for ( Iterator repoIterator = externalProfile.getRepositories().iterator(); repoIterator.hasNext(); )
            {
                Repository mavenRepo = (Repository) repoIterator.next();

                ArtifactRepository artifactRepo = null;
                try
View Full Code Here

                throw new ProjectBuildingException( projectId, e.getMessage(), e );
            }

            for ( Iterator it = activeProfiles.iterator(); it.hasNext(); )
            {
                Profile profile = (Profile) it.next();

                profileInjector.inject( profile, model );
            }
        }
        else
View Full Code Here

                    for ( Iterator it = root.getProfiles().iterator(); it.hasNext(); )
                    {
                        org.apache.maven.profiles.Profile rawProfile = (org.apache.maven.profiles.Profile) it.next();

                        Profile converted = ProfilesConversionUtils.convertFromProfileXmlProfile( rawProfile );

                        profileManager.addProfile( converted );
                    }
                }
            }
View Full Code Here

            if ( root != null )
            {
                List<org.apache.maven.profiles.Profile> profiles = root.getProfiles();
                for ( org.apache.maven.profiles.Profile rawProfile : profiles )
                {
                    Profile converted = ProfilesConversionUtils.convertFromProfileXmlProfile( rawProfile );
                    profileManager.addProfile( converted );
                    profileManager.explicitlyActivate( converted.getId() );
                }
            }
            else if ( getLog().isDebugEnabled() )
            {
                getLog().debug( "ProfilesRoot was found to be NULL" );
View Full Code Here

        }

        List<org.apache.maven.settings.Profile> profiles = settings.getProfiles();
        for ( org.apache.maven.settings.Profile rawProfile : profiles )
        {
            Profile profile = SettingsUtils.convertFromSettingsProfile( rawProfile );
            profileManager.addProfile( profile );
            profileManager.explicitlyActivate( profile.getId() );
        }
    }
View Full Code Here

            modulePaths.addAll( model.getModules() );

            for ( Iterator it = model.getProfiles().iterator(); it.hasNext(); )
            {
                Profile profile = (Profile) it.next();
                modulePaths.addAll( profile.getModules() );
            }

            for ( Iterator it = modulePaths.iterator(); it.hasNext(); )
            {
                String modulePath = (String) it.next();
View Full Code Here

            mavenExecutionRequest.getSystemProperties().put( "maven.home", this.mavenHome.getAbsolutePath() );
        }
      
        if (mavenRequest.getProfiles() != null && !mavenRequest.getProfiles().isEmpty()) {
            for (String id : mavenRequest.getProfiles()) {
                Profile p = new Profile();
                p.setId( id );
                p.setSource( "cli" );
                mavenExecutionRequest.addProfile( p );
                mavenExecutionRequest.addActiveProfile( id );
            }
        }
View Full Code Here

TOP

Related Classes of org.apache.maven.model.Profile

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.