當前位置: 首頁>>代碼示例>>Java>>正文


Java Settings.getMirrors方法代碼示例

本文整理匯總了Java中org.apache.maven.settings.Settings.getMirrors方法的典型用法代碼示例。如果您正苦於以下問題:Java Settings.getMirrors方法的具體用法?Java Settings.getMirrors怎麽用?Java Settings.getMirrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.maven.settings.Settings的用法示例。


在下文中一共展示了Settings.getMirrors方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getMirrorInfo

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
/**
 * if the repository has a mirror, then create a repositoryinfo object for it..
 */

private RepositoryInfo getMirrorInfo(RepositoryInfo info, MirrorSelector selector, Settings settings) {
    RemoteRepository original = new RemoteRepository.Builder(info.getId(), /* XXX do we even support any other layout?*/"default", info.getRepositoryUrl()).build();
    RemoteRepository mirror = selector.getMirror(original);
    if (mirror != null) {
        try {
            String name = mirror.getId();
            //#213078 need to lookup name for mirror
            for (Mirror m : settings.getMirrors()) {
                if (m.getId() != null && m.getId().equals(mirror.getId())) {
                    name = m.getName();
                    break;
                }
            }
            RepositoryInfo toret = new RepositoryInfo(mirror.getId(), name, null, mirror.getUrl());
            toret.setMirrorStrategy(RepositoryInfo.MirrorStrategy.NONE);
            return toret;
        } catch (URISyntaxException ex) {
            Exceptions.printStackTrace(ex);
        }
    }
    return null;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:RepositoryPreferences.java

示例2: createMirrorSelector

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
private MirrorSelector createMirrorSelector(Settings settings) {
	DefaultMirrorSelector selector = new DefaultMirrorSelector();
	for (Mirror mirror : settings.getMirrors()) {
		selector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false,
				mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
	}
	return selector;
}
 
開發者ID:vikrammane23,項目名稱:https-github.com-g0t4-jenkins2-course-spring-boot,代碼行數:9,代碼來源:MavenSettings.java

示例3: createMirrorSelector

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
private DefaultMirrorSelector createMirrorSelector(Settings settings)
{
   final DefaultMirrorSelector mirrorSelector = new DefaultMirrorSelector();
   final List<Mirror> mirrors = settings.getMirrors();
   if (mirrors != null)
   {
      for (Mirror mirror : mirrors)
      {
         mirrorSelector.add(mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
                  mirror.getMirrorOfLayouts());
      }
   }
   return mirrorSelector;
}
 
開發者ID:forge,項目名稱:furnace,代碼行數:15,代碼來源:MavenContainer.java

示例4: addRequestRepositoriesTo

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
private void addRequestRepositoriesTo( final Set<Location> locs,
                                       final List<ArtifactRepository> artifactRepositories,
                                       final Settings settings, final MirrorSelector mirrorSelector )
    throws MalformedURLException
{
    if ( artifactRepositories != null )
    {
        for ( final ArtifactRepository repo : artifactRepositories )
        {
            // TODO: Authentication via memory password manager.
            String id = repo.getId();
            String url = repo.getUrl();

            if ( url.startsWith( "file:" ) )
            {
                locs.add( new SimpleLocation( id, url ) );
            }
            else
            {
                final List<Mirror> mirrors = settings.getMirrors();
                if ( mirrors != null )
                {
                    final Mirror mirror = mirrorSelector == null ? null : mirrorSelector.getMirror( repo, mirrors );
                    if ( mirror != null )
                    {
                        id = mirror.getId();
                        url = mirror.getUrl();
                    }
                }

                final ArtifactRepositoryPolicy releases = repo.getReleases();
                final ArtifactRepositoryPolicy snapshots = repo.getSnapshots();

                SimpleHttpLocation addition = new SimpleHttpLocation( id, url,
                                                                      snapshots != null && snapshots.isEnabled(),
                                                                      releases == null || releases.isEnabled(), true, false,
                                                                      null );

                addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60);

                locs.add (addition);
            }
        }
    }
}
 
開發者ID:release-engineering,項目名稱:pom-manipulation-ext,代碼行數:46,代碼來源:MavenLocationExpander.java

示例5: addSettingsProfileRepositoriesTo

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
private void addSettingsProfileRepositoriesTo( final Set<Location> locs, final Settings settings,
                                               final List<String> activeProfiles,
                                               final MirrorSelector mirrorSelector )
    throws MalformedURLException
{
    if ( settings != null )
    {
        final Map<String, Profile> profiles = settings.getProfilesAsMap();
        if ( profiles != null && activeProfiles != null && !activeProfiles.isEmpty() )
        {
            final LinkedHashSet<String> active = new LinkedHashSet<>( activeProfiles );

            final List<String> settingsActiveProfiles = settings.getActiveProfiles();
            if ( settingsActiveProfiles != null && !settingsActiveProfiles.isEmpty() )
            {
                active.addAll( settingsActiveProfiles );
            }

            for ( final String profileId : active )
            {
                final Profile profile = profiles.get( profileId );
                if ( profile != null )
                {
                    final List<Repository> repositories = profile.getRepositories();
                    if ( repositories != null )
                    {
                        final List<Mirror> mirrors = settings.getMirrors();
                        final ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
                        for ( final Repository repo : repositories )
                        {
                            String id = repo.getId();
                            String url = repo.getUrl();

                            if ( mirrors != null )
                            {
                                final ArtifactRepositoryPolicy snapshots = convertPolicy( repo.getSnapshots() );
                                final ArtifactRepositoryPolicy releases = convertPolicy( repo.getReleases() );

                                final MavenArtifactRepository arepo =
                                    new MavenArtifactRepository( id, url, layout, snapshots, releases );

                                final Mirror mirror =
                                    mirrorSelector == null ? null : mirrorSelector.getMirror( arepo, mirrors );

                                if ( mirror != null )
                                {
                                    id = mirror.getId();
                                    url = mirror.getUrl();
                                }

                                SimpleHttpLocation addition = new SimpleHttpLocation( id, url, snapshots.isEnabled(), releases.isEnabled(), true, false, null );

                                addition.setAttribute(Location.CONNECTION_TIMEOUT_SECONDS, 60);

                                locs.add (addition);
                            }
                        }
                    }

                }
            }
        }
    }
}
 
開發者ID:release-engineering,項目名稱:pom-manipulation-ext,代碼行數:65,代碼來源:MavenLocationExpander.java

示例6: populateFromSettings

import org.apache.maven.settings.Settings; //導入方法依賴的package包/類
public MavenExecutionRequest populateFromSettings( MavenExecutionRequest request, Settings settings )
    throws MavenExecutionRequestPopulationException
{
    if ( settings == null )
    {
        return request;
    }

    request.setOffline( settings.isOffline() );

    request.setInteractiveMode( settings.isInteractiveMode() );

    request.setPluginGroups( settings.getPluginGroups() );

    request.setLocalRepositoryPath( settings.getLocalRepository() );

    for ( Server server : settings.getServers() )
    {
        server = server.clone();

        request.addServer( server );
    }

    //  <proxies>
    //    <proxy>
    //      <active>true</active>
    //      <protocol>http</protocol>
    //      <host>proxy.somewhere.com</host>
    //      <port>8080</port>
    //      <username>proxyuser</username>
    //      <password>somepassword</password>
    //      <nonProxyHosts>www.google.com|*.somewhere.com</nonProxyHosts>
    //    </proxy>
    //  </proxies>

    for ( Proxy proxy : settings.getProxies() )
    {
        if ( !proxy.isActive() )
        {
            continue;
        }

        proxy = proxy.clone();

        request.addProxy( proxy );
    }

    // <mirrors>
    //   <mirror>
    //     <id>nexus</id>
    //     <mirrorOf>*</mirrorOf>
    //     <url>http://repository.sonatype.org/content/groups/public</url>
    //   </mirror>
    // </mirrors>

    for ( Mirror mirror : settings.getMirrors() )
    {
        mirror = mirror.clone();

        request.addMirror( mirror );
    }

    request.setActiveProfiles( settings.getActiveProfiles() );

    for ( org.apache.maven.settings.Profile rawProfile : settings.getProfiles() )
    {
        request.addProfile( SettingsUtils.convertFromSettingsProfile( rawProfile ) );
    }

    return request;
}
 
開發者ID:gems-uff,項目名稱:oceano,代碼行數:72,代碼來源:DefaultMavenExecutionRequestPopulator.java


注:本文中的org.apache.maven.settings.Settings.getMirrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。