throw new RepositoryConversionException( getI18NString( "exception.repositories.match" ) );
}
if ( validateMetadata( artifact ) )
{
FileTransaction transaction = new FileTransaction();
if ( copyPom( artifact, targetRepository, transaction ) )
{
if ( copyArtifact( artifact, targetRepository, transaction ) )
{
Metadata metadata = createBaseMetadata( artifact );
Versioning versioning = new Versioning();
versioning.addVersion( artifact.getBaseVersion() );
metadata.setVersioning( versioning );
updateMetadata( new ArtifactRepositoryMetadata( artifact ), targetRepository, metadata, transaction );
metadata = createBaseMetadata( artifact );
metadata.setVersion( artifact.getBaseVersion() );
versioning = new Versioning();
Matcher matcher = Artifact.VERSION_FILE_PATTERN.matcher( artifact.getVersion() );
if ( matcher.matches() )
{
Snapshot snapshot = new Snapshot();
snapshot.setBuildNumber( Integer.valueOf( matcher.group( 3 ) ).intValue() );
snapshot.setTimestamp( matcher.group( 2 ) );
versioning.setSnapshot( snapshot );
}
// TODO: merge latest/release/snapshot from source instead
metadata.setVersioning( versioning );
updateMetadata( new SnapshotArtifactRepositoryMetadata( artifact ), targetRepository, metadata,
transaction );
if ( !dryrun )
{
transaction.commit();
}
}
}
}
}