Index: src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java
===================================================================
--- src/main/java/org/apache/maven/plugin/assembly/mojos/AbstractAssemblyMojo.java	(revision 567889)
+++ 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 567889)
+++ 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: src/it/repositories/basic-repository-deploys-artifact/verify.bsh
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/verify.bsh	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/verify.bsh	(revision 0)
@@ -0,0 +1,5 @@
+import java.io.*;
+
+File junitJarInRepo = new File( basedir, "target/temp-repo/org/apache/maven/plugin/assembly/test/repository-assembly/1.0/repository-assembly-1.0-bin.zip" );
+
+return junitJarInRepo.exists();
\ No newline at end of file
Index: src/it/repositories/basic-repository-deploys-artifact/goals.txt
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/goals.txt	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/goals.txt	(revision 0)
@@ -0,0 +1 @@
+clean deploy
Index: src/it/repositories/basic-repository-deploys-artifact/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java	(revision 0)
@@ -0,0 +1,38 @@
+package org.apache.maven.plugin.assembly.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
Index: src/it/repositories/basic-repository-deploys-artifact/src/main/java/org/apache/maven/plugin/assembly/test/App.java
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/src/main/java/org/apache/maven/plugin/assembly/test/App.java	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/src/main/java/org/apache/maven/plugin/assembly/test/App.java	(revision 0)
@@ -0,0 +1,13 @@
+package org.apache.maven.plugin.assembly.test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
Index: src/it/repositories/basic-repository-deploys-artifact/src/assemble/bin.xml
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/src/assemble/bin.xml	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/src/assemble/bin.xml	(revision 0)
@@ -0,0 +1,16 @@
+<assembly>
+  <id>bin</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <repositories>
+    <repository>
+      <outputDirectory>repo</outputDirectory>
+      <scope>test</scope>
+      <includes>
+        <include>junit:junit</include>
+      </includes>
+    </repository>
+  </repositories>
+</assembly>
Index: src/it/repositories/basic-repository-deploys-artifact/pom.xml
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact/pom.xml	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact/pom.xml	(revision 0)
@@ -0,0 +1,56 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.assembly.test</groupId>
+  <artifactId>repository-assembly</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0</version>
+  <name>Maven Quick Start Archetype</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+   	<plugin>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <version>2.4-SNAPSHOT</version>
+    </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>testing</version>
+        <configuration>
+          <descriptor>src/assemble/bin.xml</descriptor>
+          <finalName>assembly</finalName>        
+        </configuration>
+
+        <executions>
+          <execution>
+            <id>assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+	<distributionManagement>
+	  <repository>
+	    <id>private</id>
+	    <name>Repository Name</name>
+	    <url>file://${basedir}/target/temp-repo</url>
+	  </repository>
+	  <snapshotRepository>
+	    <id>private</id>
+	    <name>Repository Name</name>
+	    <url>file://${basedir}/target/temp-repo</url>
+	  </snapshotRepository>
+	</distributionManagement>
+</project>
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/verify.bsh
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/verify.bsh	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/verify.bsh	(revision 0)
@@ -0,0 +1,6 @@
+import java.io.*;
+
+File junitJarNotInRepo = new File( basedir, "target/temp-repo/org/apache/maven/plugin/assembly/test/repository-assembly/1.0/repository-assembly-1.0-bin.zip" );
+File junitJarInRepo = new File( basedir, "target/temp-repo-alt/org/apache/maven/plugin/assembly/test/repository-assembly/1.0/repository-assembly-1.0-bin.zip" );
+
+return !junitJarNotInRepo.exists() && junitJarInRepo.exists();
\ No newline at end of file
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/goals.txt
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/goals.txt	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/goals.txt	(revision 0)
@@ -0,0 +1 @@
+clean deploy
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/test/java/org/apache/maven/plugin/assembly/test/AppTest.java	(revision 0)
@@ -0,0 +1,38 @@
+package org.apache.maven.plugin.assembly.test;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+/**
+ * Unit test for simple App.
+ */
+public class AppTest 
+    extends TestCase
+{
+    /**
+     * Create the test case
+     *
+     * @param testName name of the test case
+     */
+    public AppTest( String testName )
+    {
+        super( testName );
+    }
+
+    /**
+     * @return the suite of tests being tested
+     */
+    public static Test suite()
+    {
+        return new TestSuite( AppTest.class );
+    }
+
+    /**
+     * Rigourous Test :-)
+     */
+    public void testApp()
+    {
+        assertTrue( true );
+    }
+}
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/main/java/org/apache/maven/plugin/assembly/test/App.java
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/main/java/org/apache/maven/plugin/assembly/test/App.java	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/main/java/org/apache/maven/plugin/assembly/test/App.java	(revision 0)
@@ -0,0 +1,13 @@
+package org.apache.maven.plugin.assembly.test;
+
+/**
+ * Hello world!
+ *
+ */
+public class App 
+{
+    public static void main( String[] args )
+    {
+        System.out.println( "Hello World!" );
+    }
+}
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/assemble/bin.xml
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/assemble/bin.xml	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/src/assemble/bin.xml	(revision 0)
@@ -0,0 +1,16 @@
+<assembly>
+  <id>bin</id>
+  <formats>
+    <format>zip</format>
+  </formats>
+  <includeBaseDirectory>false</includeBaseDirectory>
+  <repositories>
+    <repository>
+      <outputDirectory>repo</outputDirectory>
+      <scope>test</scope>
+      <includes>
+        <include>junit:junit</include>
+      </includes>
+    </repository>
+  </repositories>
+</assembly>
Index: src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/pom.xml
===================================================================
--- src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/pom.xml	(revision 0)
+++ src/it/repositories/basic-repository-deploys-artifact-with-distribution-management/pom.xml	(revision 0)
@@ -0,0 +1,67 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>org.apache.maven.plugin.assembly.test</groupId>
+  <artifactId>repository-assembly</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0</version>
+  <name>Maven Quick Start Archetype</name>
+  <url>http://maven.apache.org</url>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+  <build>
+    <plugins>
+    <plugin>
+        <artifactId>maven-deploy-plugin</artifactId>
+        <version>2.4-SNAPSHOT</version>
+    </plugin>
+      <plugin>
+        <artifactId>maven-assembly-plugin</artifactId>
+        <version>testing</version>
+        <configuration>
+          <descriptor>src/assemble/bin.xml</descriptor>
+          <finalName>assembly</finalName>
+			<distributionManagement>
+			  <repository>
+			    <id>private</id>
+			    <name>Repository Name</name>
+			    <url>file://${basedir}/target/temp-repo-alt</url>
+			  </repository>
+			  <snapshotRepository>
+			    <id>private</id>
+			    <name>Repository Name</name>
+			    <url>file://${basedir}/target/temp-repo-alt</url>
+			  </snapshotRepository>
+			</distributionManagement>
+        </configuration>
+        <executions>
+          <execution>
+            <id>assembly</id>
+            <phase>package</phase>
+            <goals>
+              <goal>single</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+	<distributionManagement>
+	  <repository>
+	    <id>private</id>
+	    <name>Repository Name</name>
+	    <url>file://${basedir}/target/temp-repo</url>
+	  </repository>
+	  <snapshotRepository>
+	    <id>private</id>
+	    <name>Repository Name</name>
+	    <url>file://${basedir}/target/temp-repo</url>
+	  </snapshotRepository>
+	</distributionManagement>
+</project>
Index: pom.xml
===================================================================
--- pom.xml	(revision 567889)
+++ 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>
@@ -345,12 +345,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>
@@ -380,12 +380,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>
