{
addWarning( artifact, Messages.getString( "unable.to.validate.metadata" ) ); //$NON-NLS-1$
return;
}
FileTransaction transaction = new FileTransaction();
if ( !copyPom( artifact, targetRepository, transaction ) )
{
addWarning( artifact, Messages.getString( "unable.to.copy.pom" ) ); //$NON-NLS-1$
return;
}
if ( !copyArtifact( artifact, targetRepository, transaction ) )
{
addWarning( artifact, Messages.getString( "unable.to.copy.artifact" ) ); //$NON-NLS-1$
return;
}
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.parseInt( matcher.group( 3 ) ) );
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 )
{
try
{
transaction.commit();
}
catch ( TransactionException e )
{
throw new ArtifactConversionException( Messages.getString( "transaction.failure", e.getMessage() ),
e ); //$NON-NLS-1$