private int resolveLatestSnapshotBuildNumber( Artifact artifact, ArtifactRepository localRepository,
ArtifactRepository remoteRepository )
throws RepositoryMetadataResolutionException
{
RepositoryMetadata metadata = new SnapshotArtifactRepositoryMetadata( artifact );
if ( !wagonManager.isOnline() )
{
// build number is a required feature for metadata consistency
throw new RepositoryMetadataResolutionException(
"System is offline. Cannot resolve metadata:\n" + metadata.extendedToString() + "\n\n" );
}
getLogger().info( "Retrieving previous build number from " + remoteRepository.getId() );
repositoryMetadataManager.resolveAlways( metadata, localRepository, remoteRepository );
int buildNumber = 0;
Metadata repoMetadata = metadata.getMetadata();
if ( repoMetadata != null )
{
if ( repoMetadata.getVersioning() != null && repoMetadata.getVersioning().getSnapshot() != null )
{
buildNumber = repoMetadata.getVersioning().getSnapshot().getBuildNumber();