org.apache.maven.model.Repository.getReleases()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(97)

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

Repository.getReleases介绍

[英]Get how to handle downloading of releases from this repository.
[中]获取如何处理从此存储库下载版本。

代码示例

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

protected void mergeRepository_Releases( Repository target, Repository source, boolean sourceDominant,
                     Map<Object, Object> context )
{
  RepositoryPolicy src = source.getReleases();
  if ( src != null )
  {
    RepositoryPolicy tgt = target.getReleases();
    if ( tgt == null )
    {
      tgt = new RepositoryPolicy();
      target.setReleases( tgt );
    }
    mergeRepositoryPolicy( tgt, src, sourceDominant, context );
  }
}

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

public static ArtifactRepository buildArtifactRepository( Repository repo,
                             ArtifactRepositoryFactory artifactRepositoryFactory,
                             PlexusContainer container )
  throws InvalidRepositoryException
{
  if ( repo != null )
  {
    String id = repo.getId();
    String url = repo.getUrl();
    if ( id == null || id.trim().length() < 1 )
    {
      throw new InvalidRepositoryException( "Repository ID must not be empty (URL is: " + url + ").", new IllegalArgumentException( "repository.id" ) );
    }
    if ( url == null || url.trim().length() < 1 )
    {
      throw new InvalidRepositoryException( "Repository URL must not be empty (ID is: " + id + ").", new IllegalArgumentException( "repository.url" ) );
    }
    // TODO: make this a map inside the factory instead, so no lookup needed
    ArtifactRepositoryLayout layout = getRepositoryLayout( repo, container );
    ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
    ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
    return artifactRepositoryFactory.createArtifactRepository( id, url, layout, snapshots, releases );
  }
  else
  {
    return null;
  }
}

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

public static Repository cloneRepository( Repository src )
{
  if ( src == null )
  {
    return null;
  }
  
  Repository result = new Repository();
  
  result.setReleases( cloneRepositoryPolicy( src.getReleases() ) );
  result.setSnapshots( cloneRepositoryPolicy( src.getSnapshots() ) );
  
  cloneRepositoryBaseFields( src, result );
  
  return result;
}

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

public static ArtifactRepository buildArtifactRepository( org.apache.maven.model.Repository repo )
  throws InvalidRepositoryException
{
  if ( repo != null )
  {
    String id = repo.getId();
    if ( StringUtils.isEmpty( id ) )
    {
      throw new InvalidRepositoryException( "Repository identifier missing", "" );
    }
    String url = repo.getUrl();
    if ( StringUtils.isEmpty( url ) )
    {
      throw new InvalidRepositoryException( "URL missing for repository " + id, id );
    }
    ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
    ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
    ArtifactRepositoryLayout layout = new DefaultRepositoryLayout();
    return createArtifactRepository( id, url, layout, snapshots, releases );
  }
  else
  {
    return null;
  }
}

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

public ArtifactRepository buildArtifactRepository( Repository repo )
  throws InvalidRepositoryException
{
  if ( repo != null )
  {
    String id = repo.getId();
    if ( StringUtils.isEmpty( id ) )
    {
      throw new InvalidRepositoryException( "Repository identifier missing", "" );
    }
    String url = repo.getUrl();
    if ( StringUtils.isEmpty( url ) )
    {
      throw new InvalidRepositoryException( "URL missing for repository " + id, id );
    }
    ArtifactRepositoryPolicy snapshots = buildArtifactRepositoryPolicy( repo.getSnapshots() );
    ArtifactRepositoryPolicy releases = buildArtifactRepositoryPolicy( repo.getReleases() );
    return createArtifactRepository( id, url, getLayout( repo.getLayout() ), snapshots, releases );
  }
  else
  {
    return null;
  }
}

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

/**
 * @param modelRepo
 * @return a repository
 */
private static Repository convertToSettingsRepository( org.apache.maven.model.Repository modelRepo )
{
  Repository repo = new Repository();
  repo.setId( modelRepo.getId() );
  repo.setLayout( modelRepo.getLayout() );
  repo.setName( modelRepo.getName() );
  repo.setUrl( modelRepo.getUrl() );
  if ( modelRepo.getSnapshots() != null )
  {
    repo.setSnapshots( convertRepositoryPolicy( modelRepo.getSnapshots() ) );
  }
  if ( modelRepo.getReleases() != null )
  {
    repo.setReleases( convertRepositoryPolicy( modelRepo.getReleases() ) );
  }
  return repo;
}

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

public static RemoteRepository toRemoteRepository( Repository repository )
{
  RemoteRepository.Builder builder =
    new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
  builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
  builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
  return builder.build();
}

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

if ( repository.getReleases() != null )
  writeRepositoryPolicy( (RepositoryPolicy) repository.getReleases(), "releases", serializer );

代码示例来源:origin: takari/polyglot-maven

private void printRepositories(String name,
    Repository... repositories) {
  for (Repository r: repositories) {
    if ( r.getReleases() == null && r.getSnapshots() == null )
    {
      p.printWithOptions( name,
                options( "id", r.getId(),
                     "name", r.getName(),
                     "url", r.getUrl() ) );
    }
    else
    {
      p.printStartBlock( name,
                options( "id", r.getId(),
                     "name", r.getName(),
                     "url", r.getUrl() ) );
      printRepositoryPolicy( "releases", r.getReleases() );
      printRepositoryPolicy( "snapshots", r.getSnapshots() );
      p.printEndBlock();
    }
  }
}

代码示例来源:origin: takari/polyglot-maven

if ( repository.getReleases() != null )
  writeRepositoryPolicy( (RepositoryPolicy) repository.getReleases(), "releases", serializer );

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

protected RemoteRepository createAntRemoteRepository( org.apache.maven.model.Repository pomRepository )
{
  RemoteRepository r = createAntRemoteRepositoryBase( pomRepository );
  if ( pomRepository.getSnapshots() != null )
  {
    r.addSnapshots( convertRepositoryPolicy( pomRepository.getSnapshots() ) );
  }
  if ( pomRepository.getReleases() != null )
  {
    r.addReleases( convertRepositoryPolicy( pomRepository.getReleases() ) );
  }
  return r;
}

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

protected RemoteRepository createAntRemoteRepository( org.apache.maven.model.Repository pomRepository )
{
  RemoteRepository r = createAntRemoteRepositoryBase( pomRepository );
  if ( pomRepository.getSnapshots() != null )
  {
    r.addSnapshots( convertRepositoryPolicy( pomRepository.getSnapshots() ) );
  }
  if ( pomRepository.getReleases() != null )
  {
    r.addReleases( convertRepositoryPolicy( pomRepository.getReleases() ) );
  }
  return r;
}

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

public static RemoteRepository toRemoteRepository( Repository repository )
{
  RemoteRepository.Builder builder =
    new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
  builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
  builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
  return builder.build();
}

代码示例来源:origin: org.jboss.shrinkwrap.resolver/shrinkwrap-resolver-impl-maven

/**
 * Converts Maven {@link Repository} to Aether {@link RemoteRepository}
 *
 * @param repository
 * the Maven repository to be converted
 * @return Equivalent remote repository
 */
public static RemoteRepository asRemoteRepository(org.apache.maven.model.Repository repository) {
  return new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl())
      .setSnapshotPolicy(asRepositoryPolicy(repository.getSnapshots()))
      .setReleasePolicy(asRepositoryPolicy(repository.getReleases())).build();
}

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

public static RemoteRepository toRemoteRepository( Repository repository )
{
  RemoteRepository.Builder builder =
    new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
  builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
  builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
  return builder.build();
}

代码示例来源:origin: io.tesla.maven/maven-aether-provider

public static RemoteRepository toRemoteRepository( Repository repository )
{
  RemoteRepository.Builder builder =
    new RemoteRepository.Builder( repository.getId(), repository.getLayout(), repository.getUrl() );
  builder.setSnapshotPolicy( toRepositoryPolicy( repository.getSnapshots() ) );
  builder.setReleasePolicy( toRepositoryPolicy( repository.getReleases() ) );
  return builder.build();
}

代码示例来源:origin: io.takari.maven.plugins/takari-lifecycle-plugin

public static RemoteRepository toRemoteRepository(Repository repository) {
 RemoteRepository.Builder builder = new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl());
 builder.setSnapshotPolicy(toRepositoryPolicy(repository.getSnapshots()));
 builder.setReleasePolicy(toRepositoryPolicy(repository.getReleases()));
 return builder.build();
}

代码示例来源:origin: com.atlassian.sdk/ap3-aether-maven-provider

public static RemoteRepository toRemoteRepository( Repository repository )
{
  RemoteRepository result = new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl())
      .setPolicy(toRepositoryPolicy(repository.getSnapshots()))
      .setPolicy(toRepositoryPolicy(repository.getReleases()))
      .build();
  return result;
}

代码示例来源:origin: shrinkwrap/resolver

/**
 * Converts Maven {@link Repository} to Aether {@link RemoteRepository}
 *
 * @param repository
 * the Maven repository to be converted
 * @return Equivalent remote repository
 */
public static RemoteRepository asRemoteRepository(org.apache.maven.model.Repository repository) {
  return new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl())
      .setSnapshotPolicy(asRepositoryPolicy(repository.getSnapshots()))
      .setReleasePolicy(asRepositoryPolicy(repository.getReleases())).build();
}

代码示例来源:origin: takari/takari-lifecycle

public static RemoteRepository toRemoteRepository(Repository repository) {
 RemoteRepository.Builder builder = new RemoteRepository.Builder(repository.getId(), repository.getLayout(), repository.getUrl());
 builder.setSnapshotPolicy(toRepositoryPolicy(repository.getSnapshots()));
 builder.setReleasePolicy(toRepositoryPolicy(repository.getReleases()));
 return builder.build();
}

相关文章