Maven - Add jar-with-dependencies as a dependency

You can do this with a maven classifier. Classfiers are used so a maven module can build multiple artefacts from the same source. Examples are jdk1.6 or 1.7 version or even the source and javadoc jars maven can build.

So try this:

<dependency>
  <groupId>yourID</groupId>
  <artifactId>seaniscool</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <classifier>jar-with-dependencies</classifier>
</dependency>

If you want to rename your classfier to a better name like withNative or complete or anything else have a look at the maven shade plugin which can also build jars with dependencies but allows some more control.


Just a side note to @msczalbach's answer

Actually, even with standarad maven-jar-plugin you can give any suffix to generated jar. Just use the configuration.

E.g:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <descriptorRefs>
            <descriptorRef>self-contained</descriptorRef>
        </descriptorRefs>
    </configuration>
</plugin>