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; }
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
/** * Method writeSnapshot. * * @param snapshot * @param serializer * @param tagName * @throws java.io.IOException */ private void writeSnapshot( Snapshot snapshot, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( snapshot.getTimestamp() != null ) { serializer.startTag( NAMESPACE, "timestamp" ).text( snapshot.getTimestamp() ).endTag( NAMESPACE, "timestamp" ); } if ( snapshot.getBuildNumber() != 0 ) { serializer.startTag( NAMESPACE, "buildNumber" ).text( String.valueOf( snapshot.getBuildNumber() ) ).endTag( NAMESPACE, "buildNumber" ); } if ( snapshot.isLocalCopy() != false ) { serializer.startTag( NAMESPACE, "localCopy" ).text( String.valueOf( snapshot.isLocalCopy() ) ).endTag( NAMESPACE, "localCopy" ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeSnapshot( Snapshot, String, XmlSerializer )
versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) ); lastUpdated = versioning.getLastUpdated(); String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
if ( s.getTimestamp() == null ? snapshot.getTimestamp() != null : !s.getTimestamp().equals( snapshot.getTimestamp() ) ) s.setTimestamp( snapshot.getTimestamp() ); changed = true;
private boolean snapshotEquals(@Nullable final Snapshot s1, @Nullable final Snapshot s2) { if (s1 == null || s2 == null) { return s1 == s2; // NOSONAR } else { return Objects.equals(s1.getTimestamp(), s2.getTimestamp()) && s1.getBuildNumber() == s2.getBuildNumber() && s1.isLocalCopy() == s2.isLocalCopy(); } }
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())); } }
assertThat( m1.getVersioning().getSnapshot().getTimestamp(), equalTo( m2.getVersioning().getSnapshot().getTimestamp() ) );
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
if ( current != null && StringUtils.isNotBlank( current.getTimestamp() ) && ( current.getBuildNumber() > 0 ) ) latest = latest.replace( SNAPSHOT_VERSION, current.getTimestamp() + "-" + current.getBuildNumber() ); buildTs = getTimeFromMetadataTimestampMaven2( current.getTimestamp() );
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
if ( snapshot.getTimestamp() != null && snapshot.getBuildNumber() > 0 ) String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) ); lastUpdated = versioning.getLastUpdated(); String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
/** * Method writeSnapshot. * * @param snapshot * @param serializer * @param tagName * @throws java.io.IOException */ private void writeSnapshot( Snapshot snapshot, String tagName, XmlSerializer serializer ) throws java.io.IOException { serializer.startTag( NAMESPACE, tagName ); if ( snapshot.getTimestamp() != null ) { serializer.startTag( NAMESPACE, "timestamp" ).text( snapshot.getTimestamp() ).endTag( NAMESPACE, "timestamp" ); } if ( snapshot.getBuildNumber() != 0 ) { serializer.startTag( NAMESPACE, "buildNumber" ).text( String.valueOf( snapshot.getBuildNumber() ) ).endTag( NAMESPACE, "buildNumber" ); } if ( snapshot.isLocalCopy() != false ) { serializer.startTag( NAMESPACE, "localCopy" ).text( String.valueOf( snapshot.isLocalCopy() ) ).endTag( NAMESPACE, "localCopy" ); } serializer.endTag( NAMESPACE, tagName ); } //-- void writeSnapshot( Snapshot, String, XmlSerializer )
private SnapshotVersion[] buildVersion( Gav gav ) throws MetadataException { if ( gav.getBaseVersion().equals( gav.getVersion() ) ) { return new SnapshotVersion[0]; } SnapshotVersion snap = new SnapshotVersion(); snap.setClassifier( gav.getClassifier() ); snap.setExtension( gav.getExtension() ); snap.setVersion( gav.getVersion() ); Snapshot timestamp = buildSnapshot( gav ); if ( timestamp != null ) { snap.setUpdated( timestamp.getTimestamp().replace( ".", "" ) ); } else { snap.setUpdated( TimeUtil.getUTCTimestamp().replace( ".", "" ) ); } return new SnapshotVersion[] { snap }; }
versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) ); lastUpdated = versioning.getLastUpdated(); String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
versioning.setLastUpdated( snapshot.getTimestamp().replace( ".", "" ) ); lastUpdated = versioning.getLastUpdated(); String qualifier = snapshot.getTimestamp() + '-' + snapshot.getBuildNumber(); version = version.substring( 0, version.length() - SNAPSHOT.length() ) + qualifier;
@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; }
final long lts = ts(lv.getSnapshot().getTimestamp()); final long rts = ts(rv.getSnapshot().getTimestamp()); if (rts > lts) { lv.setSnapshot(rv.getSnapshot());