org.apache.maven.settings.Mirror.getMirrorOf()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(151)

本文整理了Java中org.apache.maven.settings.Mirror.getMirrorOf()方法的一些代码示例,展示了Mirror.getMirrorOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Mirror.getMirrorOf()方法的具体详情如下:
包路径:org.apache.maven.settings.Mirror
类名称:Mirror
方法名:getMirrorOf

Mirror.getMirrorOf介绍

[英]Get the server ID of the repository being mirrored, e.g., "central". This MUST NOT match the mirror id.
[中]获取正在镜像的存储库的服务器ID,例如“central”。这不能与镜像id匹配。

代码示例

代码示例来源:origin: apache/maven

@Deprecated
public Mirror getMirrorOf( String repositoryId )
{
  Mirror match = null;
  java.util.List<Mirror> mirrors = getMirrors();
  if ( mirrors != null && repositoryId != null )
  {
    for ( Mirror mirror : mirrors )
    {
      if ( repositoryId.equals( mirror.getMirrorOf() ) )
      {
        match = mirror;
        break;
      }
    }
  }
  return match;
}

代码示例来源:origin: apache/maven

if ( mirror.getMirrorOf() != null )
  serializer.startTag( NAMESPACE, "mirrorOf" ).text( mirror.getMirrorOf() ).endTag( NAMESPACE, "mirrorOf" );

代码示例来源:origin: apache/maven

for ( Mirror mirror : request.getMirrors() )
  mirrorSelector.add( mirror.getId(), mirror.getUrl(), mirror.getLayout(), false, mirror.getMirrorOf(),
            mirror.getMirrorOfLayouts() );

代码示例来源:origin: apache/maven

public Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors )
{
  String repoId = repository.getId();
  if ( repoId != null && mirrors != null )
  {
    for ( Mirror mirror : mirrors )
    {
      if ( repoId.equals( mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
      {
        return mirror;
      }
    }
    for ( Mirror mirror : mirrors )
    {
      if ( matchPattern( repository, mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
      {
        return mirror;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.apache.maven/maven-settings

if ( mirror.getMirrorOf() != null )
  serializer.startTag( NAMESPACE, "mirrorOf" ).text( mirror.getMirrorOf() ).endTag( NAMESPACE, "mirrorOf" );

代码示例来源:origin: apache/maven

public static Mirror getMirror( ArtifactRepository repository, List<Mirror> mirrors )
{
  String repoId = repository.getId();
  if ( repoId != null && mirrors != null )
  {
    for ( Mirror mirror : mirrors )
    {
      if ( repoId.equals( mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
      {
        return mirror;
      }
    }
    for ( Mirror mirror : mirrors )
    {
      if ( matchPattern( repository, mirror.getMirrorOf() ) && matchesLayout( repository, mirror ) )
      {
        return mirror;
      }
    }
  }
  return null;
}

代码示例来源:origin: org.eclipse.tycho/tycho-core

private boolean isPrefixMirrorOf(ArtifactRepository repo, Mirror mirror) {
  boolean isMirrorOfRepoUrl = repo.getUrl() != null && repo.getUrl().startsWith(mirror.getMirrorOf());
  boolean matchesLayout = repo.getLayout() != null
      && repo.getLayout().getId().equals(mirror.getMirrorOfLayouts());
  return isMirrorOfRepoUrl && matchesLayout;
}

代码示例来源:origin: apache/maven

validateStringNotEmpty( problems, "mirrors.mirror.mirrorOf", mirror.getMirrorOf(), mirror.getId() );

代码示例来源:origin: spring-cloud/spring-cloud-function

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;
}

代码示例来源:origin: org.apache.maven/maven-settings

@Deprecated
public Mirror getMirrorOf( String repositoryId )
{
  Mirror match = null;
  java.util.List<Mirror> mirrors = getMirrors();
  if ( mirrors != null && repositoryId != null )
  {
    for ( Mirror mirror : mirrors )
    {
      if ( repositoryId.equals( mirror.getMirrorOf() ) )
      {
        match = mirror;
        break;
      }
    }
  }
  return match;
}

代码示例来源:origin: org.springframework.boot/spring-boot-cli

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;
}

代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven

static Optional<String> getCentralMirrorURL(Settings settings)
{
 return settings.getMirrors().stream()
      .filter(m -> "central".equals(m.getMirrorOf()) ||
          "*".equals(m.getMirrorOf()) ||
          MAVEN_CENTRAL_REPO.equals(m.getMirrorOf()))
      .map(Mirror::getUrl)
      .findFirst();
}

代码示例来源:origin: org.springframework.boot.experimental/spring-boot-thin-launcher

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;
}

代码示例来源:origin: dsyer/spring-boot-thin-launcher

private String getThinRepo() {
  String repo = getProperty("thin.repo");
  if (repo != null) {
    return repo;
  }
  for (Mirror mirror : this.settings.getMirrors()) {
    String of = mirror.getMirrorOf();
    if ("*".equals(of) || "central".equals(of)
        || (of != null && of.contains("spring"))) {
      return mirror.getUrl();
    }
  }
  return null;
}

代码示例来源:origin: io.fabric8/maven-util

/**
 * Returns the default {@link MirrorSelector} as configured in the maven settings.xml
 *
 * @return
 */
public static MirrorSelector getMirrorSelector() {
  DefaultMirrorSelector selector = new DefaultMirrorSelector();
  Settings settings = getSettings();
  for (org.apache.maven.settings.Mirror mirror : settings.getMirrors()) {
    selector.add(String.valueOf(mirror.getId()), mirror.getUrl(), mirror.getLayout(), false,
        mirror.getMirrorOf(), mirror.getMirrorOfLayouts());
  }
  return selector;
}

代码示例来源:origin: io.fabric8/fabric-maven

private MirrorSelector selectMirrors( Mirror mirror ) {
  // configure mirror
  DefaultMirrorSelector selector = new DefaultMirrorSelector();
  for( Mirror m : m_settings.getMirrors() ) {
    selector.add( m.getName(), m.getUrl(), null, false, m.getMirrorOf(), "*" );
  }
  if( mirror != null ) {
    selector.add(mirror.getName(), mirror.getUrl(), null, false, mirror.getMirrorOf(), "*");
  }
  return selector;
}

代码示例来源:origin: org.jboss.forge.furnace/furnace-manager-resolver-maven

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;
}

代码示例来源:origin: org.uberfire/uberfire-maven-integration

public RemoteRepository resolveMirroredRepo( RemoteRepository repo ) {
  for ( Mirror mirror : settings.getMirrors() ) {
    if ( isMirror( repo, mirror.getMirrorOf() ) ) {
      return toRemoteRepositoryBuilder( settings,
                       mirror.getId(),
                       mirror.getLayout(),
                       mirror.getUrl() ).build();
    }
  }
  return repo;
}

代码示例来源:origin: org.kie.soup/kie-soup-maven-integration

public RemoteRepository resolveMirroredRepo( RemoteRepository repo ) {
  for ( Mirror mirror : settings.getMirrors() ) {
    if ( isMirror( repo, mirror.getMirrorOf() ) ) {
      return toRemoteRepositoryBuilder( settings,
                       mirror.getId(),
                       mirror.getLayout(),
                       mirror.getUrl() ).build();
    }
  }
  return repo;
}

代码示例来源:origin: org.eclipse.tycho/tycho-core

private Mirror createMirror(ArtifactRepository repo, Mirror toMirror) {
  Mirror mirror = toMirror.clone();
  String urlToReplace = toMirror.getMirrorOf();
  String newUrl = StringUtils.replaceOnce(repo.getUrl(), urlToReplace, toMirror.getUrl());
  mirror.setUrl(newUrl);
  mirror.setId(toMirror.getId());
  return mirror;
}

相关文章