Jar with dependencies not included in zip file with maven assembly plugin

Viewed 1216

I am using maven assembly plugin to generate a zip file containing my jar including all dependencies, however the jar included does not contain all the jars when i use this command:

  jar tf jar-included-in-the-zip.jar

Here is my configuration:

 <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <appendAssemblyId>false</appendAssemblyId>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                </descriptorRefs>
                <finalName>my-jar</finalName>
            </configuration>
            <executions>
                <execution>
                    <id>assembly-id</id>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                    <configuration>
                        <classifier></classifier>
                        <descriptors>
                            <descriptor>assembly.xml</descriptor>
                        </descriptors>
                    </configuration>
                </execution>
            </executions>
        </plugin> 

and here is my assembly:

<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.3 http://maven.apache.org/xsd/assembly-1.1.3.xsd">

<id>xxx</id>

<formats>
    <format>zip</format>
</formats>

<includeBaseDirectory>false</includeBaseDirectory>
<fileSets>
    <fileSet>
        <directory>${my-jar.target.dir}</directory>
        <outputDirectory>${my-jar.ouput.dar.dir}/${version}</outputDirectory>
        <includes>
            <include>**/*.jar</include>
        </includes>
    </fileSet>
</fileSets>

In target i get a jar containing all dependencies, and a zip containing a jar that does not include the dependencies. How can i get to include my jar with dependencies into the zip file.

2 Answers
Related