Package org.apache.maven.settings

Examples of org.apache.maven.settings.Mirror


     */
    private Mirror parseMirror( XmlPullParser parser, boolean strict )
        throws IOException, XmlPullParserException
    {
        String tagName = parser.getName();
        Mirror mirror = new Mirror();
        for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
        {
            String name = parser.getAttributeName( i );
            String value = parser.getAttributeValue( i );

            if ( name.indexOf( ':' ) >= 0 )
            {
                // just ignore attributes with non-default namespace (for example: xmlns:xsi)
            }
            else
            {
                checkUnknownAttribute( parser, name, tagName, strict );
            }
        }
        java.util.Set parsed = new java.util.HashSet();
        while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
        {
            if ( checkFieldWithDuplicate( parser, "mirrorOf", null, parsed ) )
            {
                mirror.setMirrorOf( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
            {
                mirror.setName( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
            {
                mirror.setUrl( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "layout", null, parsed ) )
            {
                mirror.setLayout( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "mirrorOfLayouts", null, parsed ) )
            {
                mirror.setMirrorOfLayouts( getTrimmedValue( parser.nextText() ) );
            }
            else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
            {
                mirror.setId( getTrimmedValue( parser.nextText() ) );
            }
            else
            {
                checkUnknownElement( parser, strict );
            }
View Full Code Here


                }
            }

            for ( Iterator<Mirror> i = settings.getMirrors().iterator(); i.hasNext(); )
            {
                Mirror mirror = i.next();

                wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
            }
        }
        finally
        {
            container.release( wagonManager );
View Full Code Here

        if ( proxy != null )
        {
            r.addProxy( new Proxy( proxy ) );
        }

        Mirror mirror = getSettings().getMirrorOf( pomRepository.getId() );
        if ( mirror != null )
        {
            r.setUrl( mirror.getUrl() );
        }
        return r;
    }
View Full Code Here

                }
            }

            for ( Iterator i = settings.getMirrors().iterator(); i.hasNext(); )
            {
                Mirror mirror = (Mirror) i.next();

                wagonManager.addMirror( mirror.getId(), mirror.getMirrorOf(), mirror.getUrl() );
            }
        }
        finally
        {
            container.release( wagonManager );
View Full Code Here

        this.settings.setLocalRepository( new LocalRepository( localRepository ) );
    }   
   
    public void addMirror( String url )
    {
        Mirror mirror = new Mirror();
        mirror.setId( "jbundler" );
        mirror.setLayout( "default" );
        mirror.setMirrorOf( "central" );
        mirror.setName( "JBundler Maven Central Mirror" );
        mirror.setUrl( url );
        mirror.setMirrorOfLayouts( "*" );
        settings.addMirror( mirror );
    }
View Full Code Here

    {
        // TODO: actually, we need to not funnel this through the ant repository - we should pump settings into wagon
        // manager at the start like m2 does, and then match up by repository id
        // As is, this could potentially cause a problem with 2 remote repositories with different authentication info

        Mirror mirror = getMirror( getSettings().getMirrors(), repository );
        if ( mirror != null )
        {
            repository.setUrl( mirror.getUrl() );
            repository.setId( mirror.getId() );
        }

        if ( repository.getAuthentication() == null )
        {
            Server server = getSettings().getServer( repository.getId() );
View Full Code Here

        if ( repositoryId != null )
        {
            for ( Iterator it = mirrors.iterator(); it.hasNext(); )
            {
                Mirror mirror = (Mirror) it.next();

                if ( repositoryId.equals( mirror.getMirrorOf() ) )
                {
                    return mirror;
                }
            }

            for ( Iterator it = mirrors.iterator(); it.hasNext(); )
            {
                Mirror mirror = (Mirror) it.next();

                if ( matchPattern( repository, mirror.getMirrorOf() ) )
                {
                    return mirror;
                }
            }
        }
View Full Code Here

    {
        if ( repositories != null && mirrors != null )
        {
            for ( ArtifactRepository repository : repositories )
            {
                Mirror mirror = getMirror( repository, mirrors );

                if ( mirror != null )
                {
                    repository.setId( mirror.getId() );
                    repository.setUrl( mirror.getUrl() );

                    ArtifactRepositoryLayout layout = layouts.get( mirror.getLayout() );
                    if ( layout != null )
                    {
                        repository.setLayout( layout );
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.maven.settings.Mirror

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.