Index: src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java	(revision 569209)
+++ src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java	(working copy)
@@ -18,6 +18,9 @@
 
 import org.apache.maven.archiver.MavenArchiveConfiguration;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.model.DistributionManagement;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -32,6 +35,12 @@
 import org.apache.maven.plugin.assembly.utils.AssemblyFormatUtils;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectHelper;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
+import org.codehaus.plexus.PlexusConstants;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.context.Context;
+import org.codehaus.plexus.context.ContextException;
 
 import java.io.File;
 import java.util.Iterator;
@@ -44,8 +53,12 @@
  */
 public abstract class AbstractAssemblyMojo
     extends AbstractMojo
-    implements AssemblerConfigurationSource
+    implements AssemblerConfigurationSource, Contextualizable
 {
+    /**
+     * Contextualized.
+     */
+    private PlexusContainer container;
 
     /**
      * Local Maven repository where artifacts are cached during the build process.
@@ -176,6 +189,16 @@
      * @component
      */
     private MavenProjectHelper projectHelper;
+    
+    /**
+     * Specifies an alternative Distribution Management configuration to which artifacts
+     * produced by this plugin should be deployed.
+     * @parameter expression="${distributionManagement}"
+     */
+    protected DistributionManagement distributionManagement;
+    
+    /** @component */
+    private ArtifactRepositoryFactory repositoryFactory;
 
     /**
      * Temporary directory that contain the files to be assembled.
@@ -282,36 +305,57 @@
 
                     if ( attach && destFile.isFile() )
                     {
-                        if ( isAssemblyIdAppended() )
-                        {
-                            projectHelper.attachArtifact( project, format, assembly.getId(), destFile );
-                        }
-                        else if ( classifier != null )
-                        {
-                            projectHelper.attachArtifact( project, format, classifier, destFile );
-                        }
-                        else
-                        {
-                            if ( !warnedAboutMainProjectArtifact )
-                            {
-                                StringBuffer message = new StringBuffer();
-
-                                message.append( "Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing." );
-                                message.append( "\nInstead of attaching the assembly file: " ).append( destFile ).append( ", it will become the file for main project artifact." );
-                                message.append( "\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!" );
-
-                                getLog().warn( message );
-                                warnedAboutMainProjectArtifact = true;
-                            }
-
-                            File existingFile = project.getArtifact().getFile();
-                            if ( ( existingFile != null ) && existingFile.exists() )
-                            {
-                                getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile + "\nwith assembly file: " + destFile );
-                            }
-
-                            project.getArtifact().setFile( destFile );
-                        }
+                    	try
+                    	{
+                    		String attachedClassifier = null;
+                    		
+	                        if ( isAssemblyIdAppended() )
+	                        {
+	                        	attachedClassifier = assembly.getId();
+	                        }
+	                        else if ( classifier != null )
+	                        {
+	                        	attachedClassifier = classifier;
+	                        }
+	                        
+	                        if (attachedClassifier != null)
+	                        {
+	                        	if (distributionManagement != null)
+	                        	{
+	                        		projectHelper.attachArtifact( project, distributionManagement, repositoryFactory, container, format, attachedClassifier, destFile );
+	                        	}
+	                        	else
+	                        	{
+	                        		projectHelper.attachArtifact( project, format, attachedClassifier, destFile );
+	                        	}
+	                        }
+	                        else
+	                        {
+	                            if ( !warnedAboutMainProjectArtifact )
+	                            {
+	                                StringBuffer message = new StringBuffer();
+	
+	                                message.append( "Configuration options: 'appendAssemblyId' is set to false, and 'classifier' is missing." );
+	                                message.append( "\nInstead of attaching the assembly file: " ).append( destFile ).append( ", it will become the file for main project artifact." );
+	                                message.append( "\nNOTE: If multiple descriptors or descriptor-formats are provided for this project, the value of this file will be non-deterministic!" );
+	
+	                                getLog().warn( message );
+	                                warnedAboutMainProjectArtifact = true;
+	                            }
+	
+	                            File existingFile = project.getArtifact().getFile();
+	                            if ( ( existingFile != null ) && existingFile.exists() )
+	                            {
+	                                getLog().warn( "Replacing pre-existing project main-artifact file: " + existingFile + "\nwith assembly file: " + destFile );
+	                            }
+	
+	                            project.getArtifact().setFile( destFile );
+	                        }
+                    	}
+                    	catch (InvalidRepositoryException e)
+                    	{
+                    		throw new MojoExecutionException("Could not execute mojo:" + e.getMessage(), e);
+                    	}
                     }
                     else
                     {
@@ -577,4 +621,9 @@
         return remoteRepositories;
     }
 
+    public void contextualize( Context context )
+    throws ContextException
+	{
+	    this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
+	}
 }
Index: src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java	(revision 569209)
+++ src/main/java/org/apache/maven/plugin/assembly/mojos/AttachAssemblyDescriptorMojo.java	(working copy)
@@ -50,6 +50,8 @@
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+    	System.out.println("@@ Attach Assembly Descriptor Mojo");
+    	
         Artifact artifact = factory.createProjectArtifact( project.getGroupId(), project.getArtifactId(), project.getVersion() );
         artifact.setFile( project.getFile() );
 
Index: pom.xml
===================================================================
--- pom.xml	(revision 569209)
+++ pom.xml	(working copy)
@@ -10,7 +10,7 @@
   <name>Maven Assembly Plugin</name>
   <version>2.2-beta-2-SNAPSHOT</version>
   <prerequisites>
-    <maven>2.0.4</maven>
+    <maven>2.0.8-SNAPSHOT</maven>
   </prerequisites>
   <repositories>
     <repository>
@@ -404,12 +404,12 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-plugin-api</artifactId>
-      <version>2.0.4</version>
+      <version>2.0.8-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-project</artifactId>
-      <version>2.0.4</version>
+      <version>2.0.8-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -439,12 +439,12 @@
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-artifact</artifactId>
-      <version>2.0.4</version>
+      <version>2.0.8-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-model</artifactId>
-      <version>2.0.4</version>
+      <version>2.0.8-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
