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

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

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

Versioning.getSnapshot介绍

[英]Get the current snapshot data in use for this version (artifact snapshots only).
[中]获取此版本正在使用的当前快照数据(仅限工件快照)。

代码示例

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

private static int getBuildNumber( Metadata metadata )
{
  int number = 0;
  Versioning versioning = metadata.getVersioning();
  if ( versioning != null )
  {
    Snapshot snapshot = versioning.getSnapshot();
    if ( snapshot != null && snapshot.getBuildNumber() > 0 )
    {
      number = snapshot.getBuildNumber();
    }
  }
  return number;
}

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

Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )

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

if ( versioning.getSnapshot() != null )
  writeSnapshot( (Snapshot) versioning.getSnapshot(), "snapshot", serializer );

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

private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository,
                       ArtifactRepository remoteRepository )
  throws RepositoryMetadataResolutionException
{
  RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
  getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
  repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );
  int buildNumber = 0;
  Metadata repoMetadata = metadata.getMetadata();
  if ( ( repoMetadata != null )
    && ( repoMetadata.getVersioning() != null && repoMetadata.getVersioning().getSnapshot() != null ) )
  {
    buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber();
  }
  return buildNumber;
}

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

snapshot = metadata.getVersioning().getSnapshot();
lastUpdated = metadata.getVersioning().getLastUpdated();

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

if ( m.getVersioning().getSnapshot() == null )
if ( ( m.getVersioning() != null ) && ( m.getVersioning().getSnapshot() != null )
  && m.getVersioning().getSnapshot().isLocalCopy() )
  m.getVersioning().getSnapshot().setLocalCopy( false );
  metadata.setMetadata( m );
  metadata.storeInLocalRepository( localRepository, repository );

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

private boolean versioningEquals(@Nullable final Versioning v1,
                 @Nullable final Versioning v2) { // NOSONAR
 if (v1 == null || v2 == null) {
  return v1 == v2; // NOSONAR
 }
 else {
  return
   Objects.equals(v1.getLatest(), v2.getLatest()) && // NOSONAR
   Objects.equals(v1.getRelease(), v2.getRelease()) &&
   snapshotEquals(v1.getSnapshot(), v2.getSnapshot()) &&
   Objects.equals(v1.getVersions(), v2.getVersions()) &&
   snapshotVersionsEquals(v1.getSnapshotVersions(), v2.getSnapshotVersions());
 }
}

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

protected String constructVersion( Versioning versioning, String baseVersion )
{
  String version = null;
  Snapshot snapshot = versioning.getSnapshot();
  if ( snapshot != null )
  {
    if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 )
    {
      String newVersion = snapshot.getTimestamp() + "-" + snapshot.getBuildNumber();
      version = StringUtils.replace( baseVersion, Artifact.SNAPSHOT_VERSION, newVersion );
    }
    else
    {
      version = baseVersion;
    }
  }
  return version;
}

代码示例来源:origin: org.sonatype.nexus/nexus-test-harness-launcher

public static void assertEquals(Metadata m1, Metadata m2) {
 assertThat(m1, is(notNullValue()));
 assertThat(m2, is(notNullValue()));
 assertThat(m1.getArtifactId(), equalTo(m2.getArtifactId()));
 assertThat(m1.getGroupId(), equalTo(m2.getGroupId()));
 assertThat(m1.getVersion(), equalTo(m2.getVersion()));
 assertThat(m1.getVersioning(), is(notNullValue()));
 assertThat(m2.getVersioning(), is(notNullValue()));
 assertThat(m1.getVersioning().getLatest(), equalTo(m2.getVersioning().getLatest()));
 assertThat(m1.getVersioning().getRelease(), equalTo(m2.getVersioning().getRelease()));
 if (m1.getVersioning().getSnapshot() != null || m1.getVersioning().getSnapshot() != null) {
  assertThat(m1.getVersioning().getSnapshot().getBuildNumber(),
    equalTo(m2.getVersioning().getSnapshot().getBuildNumber()));
  assertThat(m1.getVersioning().getSnapshot().getTimestamp(),
    equalTo(m2.getVersioning().getSnapshot().getTimestamp()));
 }
 assertThat(m1.getVersioning().getSnapshotVersions().size(), equalTo(
   m2.getVersioning().getSnapshotVersions().size()));
 for (int i = 0; i < m1.getVersioning().getSnapshotVersions().size(); i++) {
  SnapshotVersion s1 = m1.getVersioning().getSnapshotVersions().get(i);
  SnapshotVersion s2 = get(s1, m2.getVersioning().getSnapshotVersions());
  assertThat(s1, is(notNullValue()));
  assertThat(s2, is(notNullValue()));
  assertThat(s1.getClassifier(), equalTo(s2.getClassifier()));
  assertThat(s1.getExtension(), equalTo(s2.getExtension()));
  assertThat(s1.getUpdated(), equalTo(s2.getUpdated()));
  assertThat(s1.getVersion(), equalTo(s2.getVersion()));
 }
}

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

&& versioning.getSnapshot() != null
   && versioning.getSnapshot().getBuildNumber() > 0 )
repaired.getSnapshot().setLocalCopy( true );
versioning = repaired;
throw new IOException( "Snapshot information corrupted with remote repository data"

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

assertThat( m1.getVersioning().getRelease(), equalTo( m2.getVersioning().getRelease() ) );
if ( m1.getVersioning().getSnapshot() != null || m1.getVersioning().getSnapshot() != null )
  assertThat( m1.getVersioning().getSnapshot().getBuildNumber(),
        equalTo( m2.getVersioning().getSnapshot().getBuildNumber() ) );
  assertThat( m1.getVersioning().getSnapshot().getTimestamp(),
        equalTo( m2.getVersioning().getSnapshot().getTimestamp() ) );

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

Snapshot s = v.getSnapshot();
Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null )

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

@Override
protected boolean isMetadataCorrect( Metadata oldMd, String path )
  throws IOException
{
  if ( oldMd.getArtifactId() == null || oldMd.getGroupId() == null || oldMd.getVersion() == null
    || oldMd.getVersioning() == null || oldMd.getVersioning().getSnapshot() == null
    || oldMd.getVersioning().getSnapshot().getTimestamp() == null )
  {
    return false;
  }
  Metadata md = createMetadata( path );
  if ( StringUtils.equals( oldMd.getArtifactId(), md.getArtifactId() )
    && StringUtils.equals( oldMd.getGroupId(), md.getGroupId() )
    && StringUtils.equals( oldMd.getVersion(), md.getVersion() )
    && md.getVersioning() != null
    && md.getVersioning().getSnapshot() != null
    && StringUtils.equals( oldMd.getVersioning().getSnapshot().getTimestamp(),
      md.getVersioning().getSnapshot().getTimestamp() )
    && oldMd.getVersioning().getSnapshot().getBuildNumber() == md.getVersioning().getSnapshot().getBuildNumber()
    && ( oldMd.getVersioning().getVersions().containsAll( md.getVersioning().getVersions() ) && md.getVersioning().getVersions().containsAll(
      oldMd.getVersioning().getVersions() ) )
    && equals( oldMd.getVersioning().getSnapshotVersions(), md.getVersioning().getSnapshotVersions() ) )
  {
    return true;
  }
  return false;
}

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

private static int getBuildNumber( Metadata metadata )
{
  int number = 0;
  Versioning versioning = metadata.getVersioning();
  if ( versioning != null )
  {
    Snapshot snapshot = versioning.getSnapshot();
    if ( snapshot != null && snapshot.getBuildNumber() > 0 )
    {
      number = snapshot.getBuildNumber();
    }
  }
  return number;
}

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

Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )

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

private static int getBuildNumber( Metadata metadata )
{
  int number = 0;
  Versioning versioning = metadata.getVersioning();
  if ( versioning != null )
  {
    Snapshot snapshot = versioning.getSnapshot();
    if ( snapshot != null && snapshot.getBuildNumber() > 0 )
    {
      number = snapshot.getBuildNumber();
    }
  }
  return number;
}

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

Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )

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

private static int getBuildNumber( Metadata metadata )
{
  int number = 0;
  Versioning versioning = metadata.getVersioning();
  if ( versioning != null )
  {
    Snapshot snapshot = versioning.getSnapshot();
    if ( snapshot != null && snapshot.getBuildNumber() > 0 )
    {
      number = snapshot.getBuildNumber();
    }
  }
  return number;
}

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

Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )

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

Snapshot snapshot = versioning.getSnapshot();
if ( snapshot != null && versioning.getSnapshotVersions().isEmpty() )

相关文章