title: java - maven - Force inclusion of JDBC4 in JAR
body: <p>I get a java.lang.NoClassDefFoundError: com/mysql/jdbc/exceptions/jdbc4/CommunicationsException whenever I try to launch my application as a jar, It does not occur while launching my application from IntelliJ.</p>
  
  <p>Thus I conclude this issue to being JAR Only as it works when I use it from IntelliJ, but not when I use it from the JAR.</p>
  
  <p>In my pom.xml</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;mysql&lt;/groupId&gt;
      &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
      &lt;version&gt;5.1.40&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Basically I have everything working except when I switch over to a JAR. I think this is caused by the JAR not having access to JDBC4 how do I force the inclusion of this in the JAR?</p>
  
  <p>I've tried the following solutions aswell <strong>NONE OF THEM HAVE WORKED</strong>:</p>
  
  <p><a href="https://stackoverflow.com/questions/39275029/error-trying-to-import-oracle-jdbc7-driver-with-maven#39293038">Error trying to import oracle jdbc7 driver with Maven</a></p>
  
  <p><a href="https://stackoverflow.com/questions/1074869/find-oracle-jdbc-driver-in-maven-repository">Find Oracle JDBC driver in Maven repository</a></p>
  
  <p><a href="https://stackoverflow.com/questions/39012464/maven-ojdbc-configuration-error">Maven ojdbc configuration error</a></p>
  
  <p><a href="https://stackoverflow.com/questions/29245102/maven-java-lang-classnotfoundexception-com-mysql-jdbc-driver#29249428">Maven - java.lang.ClassNotFoundException: com.mysql.jdbc.Driver</a></p>
  
  <p><a href="https://stackoverflow.com/questions/21963923/com-mysql-jdbc-exceptions-jdbc4-communicationsexception-communications-link-fa">&quot;com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure&quot; to remote database</a></p>