Deploying assembly package with maven-release-plugin

deploymentmaven-2maven-assembly-pluginmaven-release-plugin

We use Hudson and the maven-release-plugin to do the release builds. Now I have a project which contains an assembly that puts together all needed components and then packages them into a .tar.gz package with the desired directory structure.

Now I'm trying to get the release-plugin to deploy this package to our Maven repository during the release:perform goal, but only the standard stuff (sources, javadoc, POM) are deployed.

I've already bound the assembly goal to the maven package phase, and the .tar.gz gets build during the release, but not uploaded to the repository. Any hints what I'm doing wrong here ?

Here is the assembly-plugin configuration:

<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.2-beta-4</version>
    <configuration>
      <descriptors>
        <descriptor>src/main/assembly/distribution.xml</descriptor>
      </descriptors>
      <finalName>${pom.artifactId}-${pom.version}</finalName>
      <appendAssemblyId>false</appendAssemblyId>
      <tarLongFileMode>warn</tarLongFileMode>
    </configuration>
    <executions>
        <execution>
            <id>dist-assembly</id>
            <phase>package</phase>
            <goals>
                <goal>assembly</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The command I run to build a release is

mvn release:prepare release:perform release:clean

Best Answer

Meanwhile, I found 2 ways of doing what I wanted.

The maven-build-helper-plugin allows to add additional entries to the list of artifacts that should be deployed:

    <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>build-helper-maven-plugin</artifactId>
         <version>1.3</version>
         <executions>
           <execution>
             <id>attach-distribution</id>
             <phase>package</phase>
             <goals>
               <goal>attach-artifact</goal>
             </goals>
             <configuration>
               <artifacts>
                 <artifact>
                   <file>target/${pom.artifactId}-${pom.version}.tar.gz</file>
                   <type>tar.gz</type>
                 </artifact>
               </artifacts>
             </configuration>
           </execution>
         </executions>
       </plugin>

The other is as simple as it gets and someone on the maven-user mailinglist pointed this out. Simple use the assembly:single goal instead of asssembly:assembly. This way the generated artifact is uploaded to the repository during the deploy phase.

    <execution>
        <id>dist-assembly</id>
        <phase>package</phase>
        <goals>
            <goal>single</goal> <!-- that's all :) -->
        </goals>
    </execution>