title: Maven - Depend on assembled zip
body: <p>I'm trying to have a <strong>Project B</strong> pull down (and unpack) a ZIP built by <strong>Project A</strong> and deployed to a remote repository.</p>
  
  <p>The ZIP is created and attached using the <code>maven-assembly-plugin</code>, with packaging type <code>pom</code>:</p>
  
  
  
  <pre class="lang-xml prettyprint-override"><code>&lt;artifactId&gt;project-a&lt;/artifactId&gt;
  &lt;name&gt;ZIP&lt;/name&gt;
  &lt;description&gt;Used by Project B&lt;/description&gt;
  &lt;packaging&gt;pom&lt;/packaging&gt;
  
  ...
  
  &lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;distribution-package&lt;/id&gt;
        &lt;phase&gt;package&lt;/phase&gt;
        &lt;goals&gt;
          &lt;goal&gt;single&lt;/goal&gt;
        &lt;/goals&gt;
        &lt;configuration&gt;
          &lt;descriptors&gt;
            &lt;descriptor&gt;src/main/assembly/scripts.xml&lt;/descriptor&gt;
          &lt;/descriptors&gt;
          &lt;tarLongFileMode&gt;gnu&lt;/tarLongFileMode&gt;
        &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Attempting to pull it down from <strong>Project B</strong>'s pom with the <code>maven-dependency-plugin</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;copy-scripts&lt;/id&gt;
        &lt;phase&gt;package&lt;/phase&gt;
        &lt;goals&gt;
          &lt;goal&gt;copy&lt;/goal&gt;
        &lt;/goals&gt;
        &lt;configuration&gt;
          &lt;outputDirectory&gt;${basedir}/target/staging&lt;/outputDirectory&gt;
          &lt;stripVersion&gt;true&lt;/stripVersion&gt;
          &lt;artifactItems&gt;
            &lt;artifactItem&gt;
              &lt;groupId&gt;...&lt;/groupId&gt;
              &lt;artifactId&gt;...&lt;/artifactId&gt;
              &lt;version&gt;...&lt;/version&gt;
              &lt;overWrite&gt;true&lt;/overWrite&gt;
              &lt;type&gt;zip&lt;/type&gt;
            &lt;/artifactItem&gt;
          &lt;/artifactItems&gt;
        &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>fails with: <code>[ERROR] Failed to execute goal on project ...: Could not resolve dependencies for project group:artifact:pom:version: Could not find artifact group:project-a:zip:version in nexus (http://...:8081/nexus/content/groups/public) -&gt; [Help 1]</code></p>
  
  <p>I would assume this is because I specified <strong>Project A</strong>'s packaging as <code>pom</code> and not <code>zip</code>, however I can't specify <strong>Project A</strong> as packaging type <code>zip</code> because it results in:</p>
  
  <pre class="lang-xml prettyprint-override"><code>[ERROR]     Unknown packaging: zip @ line 13, column 13
  </code></pre>
  
  <p>Am I doing something wrong here or is this simply not possible?
  I just have a bunch of files that I want to bundle up into an artifact and allow multiple other projects to download and unpack them for use. Open to different suggestions...</p>
  
  <p>I've also checked to make sure that the assembled zip is indeed in the nexus.</p>
  
  <p><strong>UPDATED WITH ANSWER</strong></p>
  
  <p>For anyone else's benefit, what I was missing is that the <code>&lt;classifier&gt;</code> of the dependency has to match the <code>&lt;id&gt;</code> of the assembly. Notice where <code>thisistheattachedartifactsclassifier</code> is specified in the following files.</p>
  
  <p>scripts.xml (Project A):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;assembly&gt;
    &lt;id&gt;thisistheattachedartifactsclassifier&lt;/id&gt;
    &lt;formats&gt;
      &lt;format&gt;zip&lt;/format&gt;
    &lt;/formats&gt;
  
    &lt;fileSets&gt;
      &lt;fileSet&gt;
        &lt;directory&gt;src/main/resources&lt;/directory&gt;
        ...
      &lt;/fileSet&gt;
    &lt;/fileSets&gt;
  &lt;/assembly&gt;
  </code></pre>
  
  <p>pom.xml (Project B):</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;plugin&gt;
    &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
    &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
    &lt;executions&gt;
      &lt;execution&gt;
        &lt;id&gt;copy-scripts&lt;/id&gt;
        &lt;phase&gt;package&lt;/phase&gt;
        &lt;goals&gt;
          &lt;goal&gt;copy&lt;/goal&gt;
        &lt;/goals&gt;
        &lt;configuration&gt;
          &lt;outputDirectory&gt;${basedir}/target/staging&lt;/outputDirectory&gt;
          &lt;stripVersion&gt;true&lt;/stripVersion&gt;
          &lt;artifactItems&gt;
            &lt;artifactItem&gt;
              &lt;groupId&gt;...&lt;/groupId&gt;
              &lt;artifactId&gt;...&lt;/artifactId&gt;
              &lt;version&gt;...&lt;/version&gt;
              &lt;classifier&gt;thisistheattachedartifactsclassifier&lt;/classifier&gt;
              &lt;overWrite&gt;true&lt;/overWrite&gt;
              &lt;type&gt;zip&lt;/type&gt;
            &lt;/artifactItem&gt;
          &lt;/artifactItems&gt;
        &lt;/configuration&gt;
      &lt;/execution&gt;
    &lt;/executions&gt;
  &lt;/plugin&gt;
  </code></pre>