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

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

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

Mirror.getId介绍

暂无

代码示例

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

public String toString()
{
  StringBuilder sb = new StringBuilder( 128 );
  sb.append( "Mirror[" );
  sb.append( "id=" ).append( this.getId() );
  sb.append( ",mirrorOf=" ).append( mirrorOf );
  sb.append( ",url=" ).append( this.url );
  sb.append( ",name=" ).append( this.name );
  sb.append( "]" );
  return sb.toString();
}

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

@Override
public MavenExecutionRequest addMirror( Mirror mirror )
{
  Objects.requireNonNull( mirror, "mirror cannot be null" );
  for ( Mirror p : getMirrors() )
  {
    if ( p.getId() != null && p.getId().equals( mirror.getId() ) )
    {
      return this;
    }
  }
  getMirrors().add( mirror );
  return this;
}

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

private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
  if ( mirror != null )
  {
    ArtifactRepository original =
      createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
                   repository.getSnapshots(), repository.getReleases() );
    repository.setMirroredRepositories( Collections.singletonList( original ) );
    repository.setId( mirror.getId() );
    repository.setUrl( mirror.getUrl() );
    if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
    {
      repository.setLayout( getLayout( mirror.getLayout() ) );
    }
  }
}

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

validateStringNotEmpty( problems, "mirrors.mirror.id", mirror.getId(), mirror.getUrl() );
validateBannedCharacters( problems, "mirrors.mirror.id", Severity.WARNING, mirror.getId(), null,
             ILLEGAL_REPO_ID_CHARS );
if ( "local".equals( mirror.getId() ) )
validateStringNotEmpty( problems, "mirrors.mirror.url", mirror.getUrl(), mirror.getId() );
validateStringNotEmpty( problems, "mirrors.mirror.mirrorOf", mirror.getMirrorOf(), mirror.getId() );

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

private void injectMirror( ArtifactRepository repository, Mirror mirror )
{
  if ( mirror != null )
  {
    ArtifactRepository original =
      createArtifactRepository( repository.getId(), repository.getUrl(), repository.getLayout(),
                   repository.getSnapshots(), repository.getReleases() );
    repository.setMirroredRepositories( Collections.singletonList( original ) );
    repository.setId( mirror.getId() );
    repository.setUrl( mirror.getUrl() );
    if ( StringUtils.isNotEmpty( mirror.getLayout() ) )
    {
      repository.setLayout( getLayout( mirror.getLayout() ) );
    }
  }
}

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

@Deprecated
public ArtifactRepository getMirrorRepository( ArtifactRepository repository )
{
  Mirror mirror = mirrorSelector.getMirror( repository, legacySupport.getSession().getSettings().getMirrors() );
  if ( mirror != null )
  {
    String id = mirror.getId();
    if ( id == null )
    {
      // TODO this should be illegal in settings.xml
      id = repository.getId();
    }
    log.debug( "Using mirror: " + mirror.getUrl() + " (id: " + id + ")" );
    repository = artifactRepositoryFactory.createArtifactRepository( id, mirror.getUrl(),
                                 repository.getLayout(), repository.getSnapshots(),
                                 repository.getReleases() );
  }
  return repository;
}

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

if ( ( mirror.getId() != null ) && !mirror.getId().equals( "default" ) )
  serializer.startTag( NAMESPACE, "id" ).text( mirror.getId() ).endTag( NAMESPACE, "id" );

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

public String toString()
{
  StringBuilder sb = new StringBuilder( 128 );
  sb.append( "Mirror[" );
  sb.append( "id=" ).append( this.getId() );
  sb.append( ",mirrorOf=" ).append( mirrorOf );
  sb.append( ",url=" ).append( this.url );
  sb.append( ",name=" ).append( this.name );
  sb.append( "]" );
  return sb.toString();
}

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

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

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

if ( ( mirror.getId() != null ) && !mirror.getId().equals( "default" ) )
  serializer.startTag( NAMESPACE, "id" ).text( mirror.getId() ).endTag( NAMESPACE, "id" );

代码示例来源:origin: jetoile/hadoop-unit

private static List<RemoteRepository> getRemoteRepositories() {
  String mavenHome = getInstalledMavenHome();
  if (StringUtils.isEmpty(mavenHome)) {
    return newRepositories();
  } else {
    List<Mirror> mirrors = getLocalSettings(mavenHome).getMirrors();
    if (mirrors.isEmpty()) {
      LOGGER.info("no mirror have been defined into maven's configuration. Is going to use {} from maven.central.repo", hadoopUnitConfiguration.getString("maven.central.repo"));
      return newRepositories();
    }
    List<RemoteRepository> remoteRepositories = mirrors.stream().map(mirror -> new RemoteRepository.Builder(mirror.getId(), "default", mirror.getUrl()).build()).collect(Collectors.toList());
    return remoteRepositories;
  }
}

代码示例来源: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: org.fusesource/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: 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.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.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.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;
}

代码示例来源: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: 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.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;
}

相关文章