title: how to add local jar to maven project
body: <p>I trying a small maven project, and I try to connect to db2 database, so I need the  <code>com.ibm.db2.jcc.DB2Driver</code> jar for the connection.</p>
  
  <p>I tried many method from internet but still fail, here is some of the method I tried:</p>
  
  <ol>
  <li><p>edit in pom.xml</p>
  
  <pre><code>    &lt;dependency&gt;
          &lt;groupId&gt;com.ibm.db2&lt;/groupId&gt;
          &lt;artifactId&gt;db2jcc4&lt;/artifactId&gt;
          &lt;version&gt;10.5.0.7&lt;/version&gt;
          &lt;scope&gt;system&lt;/scope&gt;
          &lt;systemPath&gt;
              /home/Workspace/book/springData/lib/db2jcc4-10.5.0.7.jar
          &lt;/systemPath&gt;
      &lt;/dependency&gt;
  </code></pre></li>
  <li><p>use maven command to install:</p>
  
  <pre><code>mvn install:install-file -Dfile=/home/Workspace/book/springData/lib/db2jcc4-10.5.0.7.jar -DpomFile=/home/Workspace/book/springData/pom.xml
  </code></pre>
  
  <p>or</p>
  
  <pre><code>mvn install:install-file -Dfile=/home/meow/Workspace/mbsb-cib/springData/lib/db2jcc4-10.5.0.7.jar -DgroupId=com.ibm.db2 -DartifactId=db2jcc4 -Dversion=10.5.0.7 -Dpackaging=jar -DgeneratePom=true
  </code></pre></li>
  </ol>
  
  <p>But, I am still hitting could not load JDBC driver.</p>
  
  <pre><code>Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'dataSource' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.ibm.db2.jcc.DB2Driver]
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
      at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
      ... 70 more
  Caused by: java.lang.IllegalStateException: Could not load JDBC driver class [com.ibm.db2.jcc.DB2Driver]
      at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:150)
      at com.journaldev.spring.config.DataConfig.dataSource(DataConfig.java:52)
      at com.journaldev.spring.config.DataConfig$$EnhancerBySpringCGLIB$$46013fb.CGLIB$dataSource$0(&lt;generated&gt;)
      at com.journaldev.spring.config.DataConfig$$EnhancerBySpringCGLIB$$46013fb$$FastClassBySpringCGLIB$$8fec3ead.invoke(&lt;generated&gt;)
      at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
      at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:356)
      at com.journaldev.spring.config.DataConfig$$EnhancerBySpringCGLIB$$46013fb.dataSource(&lt;generated&gt;)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
      ... 71 more
  Caused by: java.lang.ClassNotFoundException: com.ibm.db2.jcc.DB2Driver from [Module "deployment.springData.war" from Service Module Loader]
      at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:412)
      at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:400)
      at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:116)
      at java.lang.Class.forName0(Native Method)
      at java.lang.Class.forName(Class.java:348)
      at org.springframework.jdbc.datasource.DriverManagerDataSource.setDriverClassName(DriverManagerDataSource.java:147)
      ... 82 more
  </code></pre>