org.apache.maven.artifact.repository.metadata.Versioning.setLatest()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(148)

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

Versioning.setLatest介绍

[英]Set what the latest version in the directory is, including snapshots.
[中]设置目录中的最新版本,包括快照。

代码示例

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

@Override
protected void merge( Metadata recessive )
{
  Versioning versioning = metadata.getVersioning();
  versioning.updateTimestamp();
  if ( recessive.getVersioning() != null )
  {
    if ( versioning.getLatest() == null )
    {
      versioning.setLatest( recessive.getVersioning().getLatest() );
    }
    if ( versioning.getRelease() == null )
    {
      versioning.setRelease( recessive.getVersioning().getRelease() );
    }
    Collection<String> versions = new LinkedHashSet<>( recessive.getVersioning().getVersions() );
    versions.addAll( versioning.getVersions() );
    versioning.setVersions( new ArrayList<>( versions ) );
  }
}

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

private static Metadata createRepositoryMetadata( Artifact artifact )
{
  Metadata metadata = new Metadata();
  metadata.setGroupId( artifact.getGroupId() );
  metadata.setArtifactId( artifact.getArtifactId() );
  Versioning versioning = new Versioning();
  versioning.addVersion( artifact.getBaseVersion() );
  if ( !artifact.isSnapshot() )
  {
    versioning.setRelease( artifact.getBaseVersion() );
  }
  if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
  {
    versioning.setLatest( artifact.getBaseVersion() );
  }
  metadata.setVersioning( versioning );
  return metadata;
}

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

versioning.setLatest( interpolatedTrimmed( parser.nextText(), "latest" ) );

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

v.setLatest( versioning.getLatest() );

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

@Override
protected void executeMojo() throws MojoExecutionException {
 Artifact projectArtifact = project.getArtifact();
 Versioning versioning = new Versioning();
 versioning.setLatest(projectArtifact.getVersion());
 versioning.updateTimestamp();
 ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning);
 projectArtifact.addMetadata(metadata);
 GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata(project.getGroupId());
 groupMetadata.addPluginMapping(getGoalPrefix(), project.getArtifactId(), project.getName());
 projectArtifact.addMetadata(groupMetadata);
}

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

@Override
protected void executeMojo() throws MojoExecutionException {
 Artifact projectArtifact = project.getArtifact();
 Versioning versioning = new Versioning();
 versioning.setLatest(projectArtifact.getVersion());
 versioning.updateTimestamp();
 ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata(projectArtifact, versioning);
 projectArtifact.addMetadata(metadata);
 GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata(project.getGroupId());
 groupMetadata.addPluginMapping(getGoalPrefix(), project.getArtifactId(), project.getName());
 projectArtifact.addMetadata(groupMetadata);
}

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

/** {@inheritDoc} */
public void execute()
  throws MojoExecutionException
{
  if ( skip )
  {
    getLog().warn( "Execution skipped" );
    return;
  }
  Artifact projectArtifact = project.getArtifact();
  Versioning versioning = new Versioning();
  versioning.setLatest( projectArtifact.getVersion() );
  versioning.updateTimestamp();
  ArtifactRepositoryMetadata metadata = new ArtifactRepositoryMetadata( projectArtifact, versioning );
  projectArtifact.addMetadata( metadata );
  GroupRepositoryMetadata groupMetadata = new GroupRepositoryMetadata( project.getGroupId() );
  groupMetadata.addPluginMapping( getGoalPrefix(), project.getArtifactId(), project.getName() );
  projectArtifact.addMetadata( groupMetadata );
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

protected Metadata cleanseMetadataForRepository( boolean snapshot, Metadata metadata )
{
  // remove base versions not belonging here
  List<String> versions = metadata.getVersioning().getVersions();
  for ( Iterator<String> iversion = versions.iterator(); iversion.hasNext(); )
  {
    // if we need snapshots and the version is not snapshot, or
    // if we need releases and the version is snapshot
    if ( ( snapshot && !Gav.isSnapshot( iversion.next() ) )
      || ( !snapshot && Gav.isSnapshot( iversion.next() ) ) )
    {
      iversion.remove();
    }
  }
  metadata.getVersioning().setLatest( getLatestVersion( metadata.getVersioning().getVersions() ) );
  if ( snapshot )
  {
    metadata.getVersioning().setRelease( null );
  }
  else
  {
    metadata.getVersioning().setRelease( metadata.getVersioning().getLatest() );
  }
  return metadata;
}

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

@Override
protected void merge( Metadata recessive )
{
  Versioning versioning = metadata.getVersioning();
  versioning.updateTimestamp();
  if ( recessive.getVersioning() != null )
  {
    if ( versioning.getLatest() == null )
    {
      versioning.setLatest( recessive.getVersioning().getLatest() );
    }
    if ( versioning.getRelease() == null )
    {
      versioning.setRelease( recessive.getVersioning().getRelease() );
    }
    Collection<String> versions = new LinkedHashSet<>( recessive.getVersioning().getVersions() );
    versions.addAll( versioning.getVersions() );
    versioning.setVersions( new ArrayList<>( versions ) );
  }
}

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

@Override
protected void merge( Metadata recessive )
{
  Versioning versioning = metadata.getVersioning();
  versioning.updateTimestamp();
  if ( recessive.getVersioning() != null )
  {
    if ( versioning.getLatest() == null )
    {
      versioning.setLatest( recessive.getVersioning().getLatest() );
    }
    if ( versioning.getRelease() == null )
    {
      versioning.setRelease( recessive.getVersioning().getRelease() );
    }
    Collection<String> versions = new LinkedHashSet<String>( recessive.getVersioning().getVersions() );
    versions.addAll( versioning.getVersions() );
    versioning.setVersions( new ArrayList<String>( versions ) );
  }
}

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

@Override
protected void merge( Metadata recessive )
{
  Versioning versioning = metadata.getVersioning();
  versioning.updateTimestamp();
  if ( recessive.getVersioning() != null )
  {
    if ( versioning.getLatest() == null )
    {
      versioning.setLatest( recessive.getVersioning().getLatest() );
    }
    if ( versioning.getRelease() == null )
    {
      versioning.setRelease( recessive.getVersioning().getRelease() );
    }
    Collection<String> versions = new LinkedHashSet<>( recessive.getVersioning().getVersions() );
    versions.addAll( versioning.getVersions() );
    versioning.setVersions( new ArrayList<>( versions ) );
  }
}

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-repository-maven

result.getVersioning().setLatest(latest);
result.getVersioning().setRelease(release);

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

private static Metadata createRepositoryMetadata( Artifact artifact )
{
  Metadata metadata = new Metadata();
  metadata.setGroupId( artifact.getGroupId() );
  metadata.setArtifactId( artifact.getArtifactId() );
  Versioning versioning = new Versioning();
  versioning.addVersion( artifact.getBaseVersion() );
  if ( !artifact.isSnapshot() )
  {
    versioning.setRelease( artifact.getBaseVersion() );
  }
  if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
  {
    versioning.setLatest( artifact.getBaseVersion() );
  }
  metadata.setVersioning( versioning );
  return metadata;
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

vs.setLatest( getLatestVersion( versions ) );

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

if (m.getVersioning() != null) {
  mr.getVersioning().setLastUpdated(latestTimestamp(mr.getVersioning().getLastUpdated(), m.getVersioning().getLastUpdated()));
  mr.getVersioning().setLatest(latestVersion(mr.getVersioning().getLatest(), m.getVersioning().getLatest()));
  mr.getVersioning().setRelease(latestVersion(mr.getVersioning().getRelease(), m.getVersioning().getRelease()));
  for (String v : m.getVersioning().getVersions()) {

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

private static Metadata createRepositoryMetadata( Artifact artifact )
{
  Metadata metadata = new Metadata();
  metadata.setGroupId( artifact.getGroupId() );
  metadata.setArtifactId( artifact.getArtifactId() );
  Versioning versioning = new Versioning();
  versioning.addVersion( artifact.getBaseVersion() );
  if ( !artifact.isSnapshot() )
  {
    versioning.setRelease( artifact.getBaseVersion() );
  }
  if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
  {
    versioning.setLatest( artifact.getBaseVersion() );
  }
  metadata.setVersioning( versioning );
  return metadata;
}

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

private static Metadata createRepositoryMetadata( Artifact artifact )
{
  Metadata metadata = new Metadata();
  metadata.setGroupId( artifact.getGroupId() );
  metadata.setArtifactId( artifact.getArtifactId() );
  Versioning versioning = new Versioning();
  versioning.addVersion( artifact.getBaseVersion() );
  if ( !artifact.isSnapshot() )
  {
    versioning.setRelease( artifact.getBaseVersion() );
  }
  if ( "maven-plugin".equals( artifact.getProperty( ArtifactProperties.TYPE, "" ) ) )
  {
    versioning.setLatest( artifact.getBaseVersion() );
  }
  metadata.setVersioning( versioning );
  return metadata;
}

代码示例来源:origin: org.sonatype.nexus/nexus-proxy

metadata.getVersioning().setLatest( latest );
metadata.getVersioning().setLatest( latest );

代码示例来源:origin: io.tesla.maven/maven-repository-metadata

versioning.setLatest( getTrimmedValue( parser.nextText() ) );

代码示例来源:origin: org.sonatype.nexus.plugins/nexus-repository-maven

versioning.setLatest(maven2Metadata.getBaseVersions().getLatest());
versioning.setRelease(maven2Metadata.getBaseVersions().getRelease());
versioning.setVersions(maven2Metadata.getBaseVersions().getVersions());

相关文章