Package org.apache.maven.settings

Examples of org.apache.maven.settings.Profile


        Map<String, Profile> originalProfileMap = originalSettings.getProfilesAsMap();
        Map<String, Profile> modifiedProfileMap = modifiedSettings.getProfilesAsMap();

        for ( Map.Entry<String, Profile> entry : modifiedProfileMap.entrySet() )
        {
            Profile profile1 = entry.getValue();
            Profile profile2 = originalProfileMap.get( entry.getKey() );

            if ( profile2 == null || hasActivationDiff( profile1.getActivation(), profile2.getActivation() )
                || hasProfilePropertiesDiff( profile1.getProperties(), profile2.getProperties() )
                || hasProfileRepositoriesDiff( profile2, profile1 )
                || hasProfilePluginRepositoriesDiff( profile2, profile1 ) )
            {
                map.put( entry.getKey(), profile1 );
            }
View Full Code Here


            if ( ( settings.getProfiles() != null ) && ( settings.getProfiles().size() > 0 ) )
            {
                serializer.startTag( NAMESPACE, "profiles" );
                for ( Iterator iter = settings.getProfiles().iterator(); iter.hasNext(); )
                {
                    Profile o = (Profile) iter.next();
                    writeProfile( o, "profile", serializer );
                }
                serializer.endTag( NAMESPACE, "profiles" );
            }
            if ( ( settings.getActiveProfiles() != null ) && ( settings.getActiveProfiles().size() > 0 ) )
View Full Code Here

        Map<String, Profile> originalProfileMap = originalSettings.getProfilesAsMap();
        Map<String, Profile> modifiedProfileMap = modifiedSettings.getProfilesAsMap();

        for ( Map.Entry<String, Profile> entry : modifiedProfileMap.entrySet() )
        {
            Profile profile1 = entry.getValue();
            Profile profile2 = originalProfileMap.get( entry.getKey() );

            if ( profile2 == null || hasActivationDiff( profile1.getActivation(), profile2.getActivation() )
                || hasProfilePropertiesDiff( profile1.getProperties(), profile2.getProperties() )
                || hasProfileRepositoriesDiff( profile2, profile1 )
                || hasProfilePluginRepositoriesDiff( profile2, profile1 ) )
            {
                map.put( entry.getKey(), profile1 );
            }
View Full Code Here

            }

            // normalize path
            localRepo = repoDir.getAbsolutePath();

            Profile profile = new Profile();
            do
            {
                profile.setId( "stagedLocalRepo" + entropy.nextLong() );
            }
            while ( settings.getProfilesAsMap().containsKey( profile.getId() ) );

            Repository repository = new Repository();
            repository.setId( profile.getId() + entropy.nextLong() );
            RepositoryPolicy policy = new RepositoryPolicy();
            policy.setEnabled( true );
            policy.setChecksumPolicy( "ignore" );
            policy.setUpdatePolicy( "never" );
            repository.setReleases( policy );
            repository.setSnapshots( policy );
            repository.setLayout( "default" );
            repository.setName( "Original Local Repository" );
            repository.setUrl( toUrl( localRepo ) );
            profile.addPluginRepository( repository );
            profile.addRepository( repository );
            settings.addProfile( profile );
            settings.addActiveProfile( profile.getId() );
            settings.setLocalRepository( stagedLocalRepo.getAbsolutePath() );

            for ( Iterator<Profile> it = settings.getProfiles().iterator(); it.hasNext(); )
            {
                profile = it.next();
                disableUpdates( profile.getRepositories() );
                disableUpdates( profile.getPluginRepositories() );
            }

            new SettingsXpp3Writer().write( WriterFactory.newXmlWriter( stagedSettingsXml ), settings );
        }
        catch ( XmlPullParserException e )
View Full Code Here

        Map<String, Profile> profilesAsMap = settings.getProfilesAsMap();
        if ( profileIds != null && !profileIds.isEmpty() )
        {
            for ( String profileId : profileIds )
            {
                Profile profile = profilesAsMap.get( profileId );
                List<Repository> repos = profile.getRepositories();
                if ( repos != null && !repos.isEmpty() )
                {
                    for ( Repository repo : repos )
                    {
                        remoteRepositories.add( factory.createArtifactRepository( repo.getId(), repo
View Full Code Here

    }

    public void testValidate()
    {
        Settings model = new Settings();
        Profile prof = new Profile();
        prof.setId( "xxx" );
        model.addProfile( prof );
        SimpleProblemCollector problems = new SimpleProblemCollector();
        validator.validate( model, problems );
        assertEquals( 0, problems.messages.size() );

        Repository repo = new Repository();
        prof.addRepository( repo );
        problems = new SimpleProblemCollector();
        validator.validate( model, problems );
        assertEquals( 2, problems.messages.size() );

        repo.setUrl( "http://xxx.xxx.com" );
View Full Code Here

    }

    public void testValidateRepository()
        throws Exception
    {
        Profile profile = new Profile();
        Repository repo = new Repository();
        repo.setId( "local" );
        profile.addRepository( repo );
        repo = new Repository();
        repo.setId( "illegal\\:/chars" );
        repo.setUrl( "http://void" );
        profile.addRepository( repo );
        Settings settings = new Settings();
        settings.addProfile( profile );

        SimpleProblemCollector problems = new SimpleProblemCollector();
        validator.validate( settings, problems );
View Full Code Here

    public void testValidateUniqueProfileId()
        throws Exception
    {
        Settings settings = new Settings();
        Profile profile1 = new Profile();
        profile1.setId( "test" );
        settings.addProfile( profile1 );
        Profile profile2 = new Profile();
        profile2.setId( "test" );
        settings.addProfile( profile2 );

        SimpleProblemCollector problems = new SimpleProblemCollector();
        validator.validate( settings, problems );
        assertEquals( 1, problems.messages.size() );
View Full Code Here

    public void testValidateUniqueRepositoryId()
        throws Exception
    {
        Settings settings = new Settings();
        Profile profile = new Profile();
        profile.setId( "pro" );
        settings.addProfile( profile );
        Repository repo1 = new Repository();
        repo1.setUrl( "http://apache.org/" );
        repo1.setId( "test" );
        profile.addRepository( repo1 );
        Repository repo2 = new Repository();
        repo2.setUrl( "http://apache.org/" );
        repo2.setId( "test" );
        profile.addRepository( repo2 );

        SimpleProblemCollector problems = new SimpleProblemCollector();
        validator.validate( settings, problems );
        assertEquals( 1, problems.messages.size() );
        assertContains( problems.messages.get( 0 ), "'profiles.profile[pro].repositories.repository.id' must be unique"
View Full Code Here

        Map<String, Profile> profilesAsMap = settings.getProfilesAsMap();
        if ( profileIds != null && !profileIds.isEmpty() )
        {
            for ( String profileId : profileIds )
            {
                Profile profile = profilesAsMap.get( profileId );
                if ( profile != null )
                {
                    List<Repository> repos = profile.getRepositories();
                    if ( repos != null && !repos.isEmpty() )
                    {
                        for ( Repository repo : repos )
                        {
                            remoteRepositories.add( factory.createArtifactRepository( repo.getId(), repo.getUrl(),
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.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.