{
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom.getFile() );
artifact.addMetadata( metadata );
}
ArtifactInstaller installer = (ArtifactInstaller) lookup( ArtifactInstaller.ROLE );
try
{
if ( !isPomArtifact )
{
installer.install( file, artifact, localRepo );
}
else
{
installer.install( pom.getFile(), artifact, localRepo );
}
}
catch ( ArtifactInstallationException e )
{
throw new BuildException(
"Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
}
// Install any attached artifacts
if (attachedArtifacts != null) {
Iterator iter = attachedArtifacts.iterator();
while (iter.hasNext()) {
AttachedArtifact attached = (AttachedArtifact)iter.next();
Artifact attachedArtifact = createArtifactFromAttached(attached, artifact);
try {
installer.install( attachedArtifact.getFile(), attachedArtifact, localRepo );
}
catch (ArtifactInstallationException e) {
throw new BuildException(
"Error installing attached artifact '" + attachedArtifact.getDependencyConflictId() + "': " + e.getMessage(), e );
}