Package org.apache.maven.model

Examples of org.apache.maven.model.Profile


            build = pom.getBuild();
         }
      }
      else
      {
         Profile profile = getProfile(pom, profileParam);
         if (profile == null)
         {
            profile = profileParam.getAsMavenProfile();
            profile.setBuild(new Build());
            pom.getProfiles().add(profile);
         }
         build = profile.getBuild();
         if (build == null)
         {
            profile.setBuild(new Build());
            build = profile.getBuild();
         }
      }
      return build;
   }
View Full Code Here


      throw new PluginNotFoundException(groupId, dependency.getArtifactId());
   }

   private Profile getProfile(Model model, org.jboss.forge.addon.maven.profiles.Profile profileParam)
   {
      Profile result = null;
      if (profileParam != null)
      {
         for (Profile profile : model.getProfiles())
         {
            if (profileParam.getId().equals(profile.getId()))
View Full Code Here

        List newProfiles = new ArrayList( profiles.size() );

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

            Profile newProfile = new Profile();

            newProfile.setId( profile.getId() );

            newProfile.setActivation( cloneProfileActivation( profile.getActivation() ) );

            newProfile.setBuild( cloneProfileBuild( profile.getBuild() ) );

            newProfile.setDependencies( cloneProfileDependencies( profile.getDependencies() ) );

            DependencyManagement dm = profile.getDependencyManagement();

            if ( dm != null )
            {
                DependencyManagement newDM = new DependencyManagement();

                newDM.setDependencies( cloneProfileDependencies( dm.getDependencies() ) );

                newProfile.setDependencyManagement( newDM );
            }

            newProfile.setDistributionManagement( cloneProfileDistributionManagement( profile
                .getDistributionManagement() ) );

            List modules = profile.getModules();

            if ( ( modules != null ) && !modules.isEmpty() )
            {
                newProfile.setModules( new ArrayList( modules ) );
            }

            newProfile.setPluginRepositories( cloneProfileRepositories( profile.getPluginRepositories() ) );

            Properties props = profile.getProperties();

            if ( props != null )
            {
                Properties newProps = new Properties();
                newProps.putAll( props );

                newProfile.setProperties( newProps );
            }

            newProfile.setReporting( cloneProfileReporting( profile.getReporting() ) );

            newProfile.setReports( profile.getReports() );

            newProfile.setRepositories( cloneProfileRepositories( profile.getRepositories() ) );

            newProfile.setSource( profile.getSource() );

            newProfiles.add( newProfile );
        }

        return newProfiles;
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() );
            }
           
            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 );
        }
        else
        {
            profile.setActivation( new AlwaysOnActivation() );
        }

        profile.setProperties( profileXmlProfile.getProperties() );

        List repos = profileXmlProfile.getRepositories();
        if ( repos != null )
        {
            for ( Iterator it = repos.iterator(); it.hasNext(); )
            {
                profile
                    .addRepository(
                        convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) it.next() ) );
            }
        }

        List pluginRepos = profileXmlProfile.getPluginRepositories();
        if ( pluginRepos != null )
        {
            for ( Iterator it = pluginRepos.iterator(); it.hasNext(); )
            {
                profile.addPluginRepository( convertFromProfileXmlRepository( (org.apache.maven.profiles.Repository) it
                    .next() ) );
            }
        }

        return profile;
View Full Code Here

        Repository repository = new Repository();
        repository.setId( "central" );
        repository.setUrl( getRemoteRepositoryURL() );

        ProfileManager profileManager = new DefaultProfileManager( getContainer() );
        Profile profile = new Profile();
        profile.setId( "profile" );
        profile.addRepository( repository );
        profileManager.addProfile( profile );
        profileManager.activateAsDefault( profile.getId() );

        List<MavenProject> reactorProjects = new ArrayList<MavenProject>();
        while ( !projectFiles.isEmpty() )
        {
            File file = (File) projectFiles.pop();
View Full Code Here

        if ( src == null )
        {
            return null;
        }
       
        Profile result = new Profile();
       
        cloneModelBaseFields( src, result );
       
        result.setActivation( cloneActivation( src.getActivation() ) );
       
        BuildBase resultBuild = null;
        if ( src.getBuild() != null )
        {
            resultBuild = new BuildBase();
            cloneBuildBaseFields( src.getBuild(), resultBuild );
        }
        result.setBuild( resultBuild );
       
        result.setId( src.getId() );
        result.setSource( src.getSource() );
       
        return result;
    }
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

        releaseDescriptor.setCheckoutDirectory( checkoutDirectory.getAbsolutePath() );
        releaseDescriptor.setPerformGoals( "deploy site-deploy" );
        releaseDescriptor.setAdditionalArguments( "-P prof1,2prof" );

        MavenProject project = (MavenProject) getVariableValueFromObject( mojo, "project" );
        Profile profile1 = new Profile();
        profile1.setId( "prof1" );
        Profile profile2 = new Profile();
        profile2.setId( "2prof" );
        project.setActiveProfiles( Arrays.asList( new Profile[]{profile1, profile2} ) );

        ReleaseManager mock = mock( ReleaseManager.class );
        mojo.setReleaseManager( mock );
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.