title: Use external dll library in Jenkins plugin
body: <p>To use an external com object I have to include the Jacob jar and dll library into my Jenkins plugin. I found the <a href="https://github.com/hackus/jacob_excel_reader" rel="nofollow">jacob_excel_reader plugin</a> which use Jacob, but the solution doesn't satisfy me. The developer added the jar dependency to the <code>pom.xml</code> file:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;com.jacob&lt;/groupId&gt;
    &lt;artifactId&gt;jacob&lt;/artifactId&gt;
    &lt;version&gt;1.17-M2&lt;/version&gt;
    &lt;scope&gt;system&lt;/scope&gt;
    &lt;systemPath&gt;${project.basedir}/lib/jacob.jar&lt;/systemPath&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and integrates the dll file via the argument:</p>
  
  <pre><code>-Djava.library.path=${workspace_loc:jacob_excel_reader}\lib
  </code></pre>
  
  <p><strong>Is this the only way to integrate a dll?</strong> I tried it another way but I got stuck halfway and I definitely need your help!</p>
  
  <p>First I added the dependency for the jar and dll file to the <code>pom.xml</code>:</p>
  
  <pre><code>&lt;dependency&gt;
    &lt;groupId&gt;net.sf.jacob-project&lt;/groupId&gt;
    &lt;artifactId&gt;jacob&lt;/artifactId&gt;
    &lt;version&gt;1.14.3&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
    &lt;groupId&gt;net.sf.jacob-project&lt;/groupId&gt;
    &lt;artifactId&gt;jacob&lt;/artifactId&gt;
    &lt;version&gt;1.14.3&lt;/version&gt;
    &lt;classifier&gt;x86&lt;/classifier&gt;
    &lt;type&gt;dll&lt;/type&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>and configure that the dll file will be copied to <code>target/APPNAME/WEB-INF/lib</code>:</p>
  
  <pre><code>&lt;build&gt;
    &lt;plugins&gt;
      &lt;plugin&gt;
        &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
        &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt;
        &lt;executions&gt;
          &lt;execution&gt;
            &lt;id&gt;copy-dependencies&lt;/id&gt;
            &lt;phase&gt;prepare-package&lt;/phase&gt;
            &lt;goals&gt;
              &lt;goal&gt;copy-dependencies&lt;/goal&gt;
            &lt;/goals&gt;
            &lt;configuration&gt;
              &lt;excludeTransitive&gt;true&lt;/excludeTransitive&gt;
              &lt;includeArtifactIds&gt;jacob&lt;/includeArtifactIds&gt;
              &lt;includeTypes&gt;dll&lt;/includeTypes&gt;
              &lt;failOnMissingClassifierArtifact&gt;true&lt;/failOnMissingClassifierArtifact&gt;
              &lt;silent&gt;false&lt;/silent&gt;
              &lt;outputDirectory&gt;target/APPNAME/WEB-INF/lib&lt;/outputDirectory&gt;
              &lt;overWriteReleases&gt;true&lt;/overWriteReleases&gt;
              &lt;overWriteSnapshots&gt;true&lt;/overWriteSnapshots&gt;
            &lt;/configuration&gt;
          &lt;/execution&gt;
        &lt;/executions&gt;
      &lt;/plugin&gt;
    &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>When I run <code>mvn package</code> the default tests throw a warning:</p>
  
  <pre><code>SEVERE: Failed Inspecting plugin C:\...\AppData\Local\Temp\hudson7697228528744044800tmp\the.jpl
  java.util.zip.ZipException: error in opening zip file
  </code></pre>
  
  <p>but it copies the dll and jar file to <code>target/APPNAME/WEB-INF/lib</code>. <strong>Why does it copy the jar file too and what causes the ZipException?</strong></p>
  
  <p>During the plugin execution the plugins throws:</p>
  
  <pre><code>FATAL: no jacob-1.14.3-x86 in java.library.path
  java.lang.UnsatisfiedLinkError: no jacob-1.14.3-x86 in java.library.path
  </code></pre>
  
  <p>and <strong>cannot find the dll file, why?</strong> Can I add <code>target/APPNAME/WEB-INF/lib</code> to the <code>java.library.path</code> <strong>without using the argument above?</strong></p>