in src/main/java/org/apache/maven/artifact/ant/DeployTask.java [89:148]
protected void doExecute()
{
if ( file == null && ( attachedArtifacts.size() == 0 ) )
{
throw new BuildException( "You must specify a file and/or an attached artifact "
+ "to deploy to the repository." );
}
ArtifactRepository localRepo = createLocalArtifactRepository();
Pom pom = initializePom( localRepo );
if ( pom == null )
{
throw new BuildException( "A POM element is required to deploy to the repository" );
}
Artifact artifact = pom.getArtifact();
// Deploy the POM
boolean isPomArtifact = "pom".equals( pom.getPackaging() );
if ( !isPomArtifact )
{
ArtifactMetadata metadata = new ProjectArtifactMetadata( artifact, pom.getFile() );
artifact.addMetadata( metadata );
}
ArtifactRepository deploymentRepository = getDeploymentRepository( pom, artifact );
log( "Deploying to " + deploymentRepository.getUrl(), Project.MSG_INFO );
ArtifactDeployer deployer = (ArtifactDeployer) lookup( ArtifactDeployer.ROLE );
try
{
if ( file != null )
{
if ( !isPomArtifact )
{
deployer.deploy( file, artifact, deploymentRepository, localRepo );
}
else
{
deployer.deploy( pom.getFile(), artifact, deploymentRepository, localRepo );
}
}
// Deploy any attached artifacts
if ( attachedArtifacts != null )
{
for ( Artifact attachedArtifact : pom.getAttachedArtifacts() )
{
deployer.deploy( attachedArtifact.getFile(), attachedArtifact, deploymentRepository, localRepo );
}
}
}
catch ( ArtifactDeploymentException e )
{
throw new BuildException(
"Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
}
}