You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Andy Yeung <an...@cherrypicks.com> on 2006/09/01 13:13:20 UTC

Disable adding artifact in Maven Assembly Plugin

Hi all,

  I have tried to use the assembly plugin to create a zip for deploy purpose. I would like to put those zip into another location during deploy phase other than the maven repository (I would like to have a simpler structure so users can browse them easily).
  I successfully created the assembly and deploy to the custom location by using the config below. 
             <plugin>
              <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>deploy-assembly</id>
                        <phase>package</phase>
                        <configuration>
                            <outputDirectory>target/assembly</outputDirectory>
                            <localRepository></localRepository>
                            <descriptors>
                                <value>src/main/assembly/deploy.xml</value>
                            </descriptors>
                        </configuration>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.myfaces.maven</groupId> 
                <artifactId>wagon-maven-plugin</artifactId> 
                <version>1.0.2</version>
                <executions>
                    <execution>
                        <id>release-deploy</id>
                        <phase>deploy</phase>
                        <configuration>
                            <inputDirectory>target/assembly</inputDirectory>
                            <id>233</id>
                            <url>scp://192.168.0.233/repository/release/Common</url>
                        </configuration>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

  However I found that during install:install and deploy:deploy. The zip file created from assembly will be uploaded to the maven repository also. I found the following code in the assembly plugin
    
   private void createAssembly(Assembly assembly)
        throws MojoExecutionException, MojoFailureException
    {
        String fullName = getDistributionName(assembly);
        for(Iterator i = assembly.getFormats().iterator(); i.hasNext();)
        {
            ....... other code.....
            if(appendAssemblyId)
                projectHelper.attachArtifact(super.project, format, assembly.getId(), destFile);
            else
            if(super.classifier != null)
                projectHelper.attachArtifact(super.project, format, super.classifier, destFile);
            else
                projectHelper.attachArtifact(super.project, format, null, destFile);
        }

  And I found that install and deploy plugin will iterate the attachedArtifacts and upload all files to local and remote repository. It would be a good feature for source and javadoc assembly. However in 
my case, I will have files duplicated in my custom location and the repository. Is there a way bypass the attachArtifact part?

Regards,
Andy Yeung