Intellij Java 2016 & Maven : how to embed dependencies in JAR? : <p>I'm using Intellij Java 2016.2.2 and Maven to create a very simple Java console application.</p>

<p>I want to add an external library, so I add my dependency in Maven like this:</p>

<pre><code>&lt;dependency&gt;
    &lt;groupId&gt;jline&lt;/groupId&gt;
    &lt;artifactId&gt;jline&lt;/artifactId&gt;
    &lt;version&gt;2.12&lt;/version&gt;
&lt;/dependency&gt;
</code></pre>

<p>It works fine when I run it in the IDE, but not in an external console (I have the following error: <em>java.lang.NoClassDefFoundError</em>).</p>

<p>I checked and for some reason, the external JAR is not added in the JAR I just generated. I also tried many things in "File -> Project Structure", but still not working...</p>

<p>I just want to build my JAR with my dependencies in it, so I can simply run my application in a console using:</p>

<pre><code>java -jar myproject.jar
</code></pre>

<p>How can I do that? Thanks for your help!</p>
