Using maven assembly plugin to create ZIP file containing a fat jar (jar-with-dependencies)
<p>I am using the maven assembly-plugin and I want to create a ZIP file, which among other files contains a fat jar (jar-with-dependencies). I cannot create this in one run using <code>mvn package</code>. I can either uncomment the configuration for the <code>descriptor</code> or uncomment the <code>jar-with-dependencies</code> part.</p>

<p>The <code>build</code> section of the <code>pom.xml</code> is as follows:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;build&gt;
    &lt;plugins&gt;
        &lt;plugin&gt;
            &lt;artifactId&gt;maven-assembly-plugin&lt;/artifactId&gt;
            &lt;configuration&gt;
                &lt;descriptors&gt;
                    &lt;descriptor&gt;src/main/assembly/dist.xml&lt;/descriptor&gt;
                &lt;/descriptors&gt;
                &lt;finalName&gt;sample-documentum-downloader&lt;/finalName&gt;
            &lt;/configuration&gt;

            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;id&gt;jar-with-dependencies&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;finalName&gt;${project.artifactId}&lt;/finalName&gt;
                        &lt;appendAssemblyId&gt;false&lt;/appendAssemblyId&gt;
                        &lt;descriptorRefs&gt;
                            &lt;descriptorRef&gt;jar-with-dependencies&lt;/descriptorRef&gt;
                        &lt;/descriptorRefs&gt;
                        &lt;archive&gt;
                            &lt;manifest&gt;
                                &lt;addClasspath&gt;true&lt;/addClasspath&gt;
                                &lt;mainClass&gt;com.foo.DownloadDocuments&lt;/mainClass&gt;
                            &lt;/manifest&gt;
                        &lt;/archive&gt;
                    &lt;/configuration&gt;
                &lt;/execution&gt;

                &lt;execution&gt;
                    &lt;id&gt;assemble-all&lt;/id&gt;
                    &lt;phase&gt;package&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;single&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;
    &lt;/plugins&gt;
&lt;/build&gt;
</code></pre>

<p>and the <code>dist.xml</code> is:</p>

<pre class="lang-xml prettyprint-override"><code>&lt;assembly&gt;
&lt;id&gt;dist&lt;/id&gt;
&lt;formats&gt;
    &lt;format&gt;zip&lt;/format&gt;
&lt;/formats&gt;
&lt;files&gt;
    &lt;file&gt;
        &lt;source&gt;target/${project.artifactId}.jar&lt;/source&gt;
        &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
    &lt;/file&gt;
    &lt;file&gt;
        &lt;source&gt;data/input/docId.txt&lt;/source&gt;
        &lt;outputDirectory&gt;data/input/&lt;/outputDirectory&gt;
    &lt;/file&gt;
    &lt;file&gt;
        &lt;source&gt;data/export/exported_files_will_be_created_here.txt&lt;/source&gt;
        &lt;outputDirectory&gt;data/export/&lt;/outputDirectory&gt;
    &lt;/file&gt;
    &lt;file&gt;
        &lt;source&gt;src/main/resources/dfc.properties&lt;/source&gt;
        &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
    &lt;/file&gt;
    &lt;file&gt;
        &lt;source&gt;src/main/resources/dfc.keystore&lt;/source&gt;
        &lt;outputDirectory&gt;/&lt;/outputDirectory&gt;
    &lt;/file&gt;

&lt;/files&gt;
&lt;fileSets&gt;
    &lt;fileSet&gt;
        &lt;directory&gt;${project.basedir}&lt;/directory&gt;
        &lt;includes&gt;
            &lt;include&gt;*.cmd&lt;/include&gt;
            &lt;include&gt;README.pdf&lt;/include&gt;
        &lt;/includes&gt;
        &lt;useDefaultExcludes&gt;true&lt;/useDefaultExcludes&gt;
    &lt;/fileSet&gt;
&lt;/fileSets&gt;
</code></pre>

<p></p>

<p>How can I restructure to create a ZIP including the far JAR in one run.</p>

<p>Thanks for your support.</p>