title: Having a 3rd party jar included in Maven shaded jar without adding it to local repository
body: <p>I already found an answer here on Stack Overflow how to include a 3rd party JAR in a project without installing it to a "local repository":</p>
  
  <p><a href="https://stackoverflow.com/questions/364114/can-i-add-jars-to-maven-2-build-classpath-without-installing-them">Can I add jars to maven 2 build classpath without installing them?</a></p>
  
  <p>But, when I use the Maven Shade Plugin to create a JAR that includes all the dependencies of the project as well, the 3rd party JAR is not included automatically.</p>
  
  <p>How can I make the Maven Shade Plugin add such a 3rd party JAR in to the shaded JAR?</p>
  
  <hr>
  
  <p>As per the answer gotten, I made it work. What I did was, added this snippet to the beginning of my pom.xml:</p>
  
  <pre><code>&lt;repositories&gt;
    &lt;repository&gt;
      &lt;id&gt;repo&lt;/id&gt;
      &lt;url&gt;file://${basedir}/repo&lt;/url&gt;
    &lt;/repository&gt;
  &lt;/repositories&gt;
  </code></pre>
  
  <p>Then added a dependency for my project, also to pom.xml:</p>
  
  <pre><code>&lt;dependencies&gt;
    &lt;dependency&gt;
      &lt;groupId&gt;dummy&lt;/groupId&gt;
      &lt;artifactId&gt;dummy&lt;/artifactId&gt;
      &lt;version&gt;0.0.0&lt;/version&gt;
      &lt;scope&gt;compile&lt;/scope&gt;
    &lt;/dependency&gt;
  &lt;/dependencies&gt;
  </code></pre>
  
  <p>And then ran a command line to add a package to 'repo':</p>
  
  <pre><code>mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file
      -Dfile=&lt;my-jar&gt;.jar -DgroupId=dummy -DartifactId=dummy
      -Dversion=0.0.0 -Dpackaging=jar -DlocalRepositoryPath=`pwd`/repo/
  </code></pre>
  
  <p>(Not sure if the repo path needs to be a full path, but didn't want to take chances.)</p>
  
  <p>The contents of the repo subdirectory is now:</p>
  
  <pre><code>repo/dummy/dummy/0.0.0/dummy-0.0.0.jar
  repo/dummy/dummy/0.0.0/dummy-0.0.0.pom
  repo/dummy/dummy/maven-metadata-local.xml
  </code></pre>
  
  <p>Now I can check this in to version control, and have no local or remote dependencies.</p>