If a JAR is accompanied with a native DLL in Maven repo what do I need to put into my pom.xml to get that DLL into the packaging?
To be more specific take for example Jacob library. How do you make jacob-1.14.3-x64.dll
go into the WEB-INF/lib
folder after you run mvn package
?
In our local Nexus repository we've got these definitions for JAR and DLL:
<dependency>
<groupId>net.sf.jacob-project</groupId>
<artifactId>jacob</artifactId>
<version>1.16-M2</version>
</dependency>
<dependency>
<groupId>net.sf.jacob-project</groupId>
<artifactId>jacob</artifactId>
<version>1.16-M2</version>
<classifier>x64</classifier>
<type>dll</type>
</dependency>
But putting the same dependencies to our project POM and running mvn package
doesn't make DLL go to WEB-INF/lib
, but JAR gets there fine.
What are we doing wrong?
Thanks to the hint from Monty0018 I was able to solve the problem. The maven code that works for me:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<excludeTransitive>true</excludeTransitive>
<includeArtifactIds>jacob</includeArtifactIds>
<failOnMissingClassifierArtifact>true</failOnMissingClassifierArtifact>
<silent>false</silent>
<outputDirectory>target/APPNAME/WEB-INF/lib</outputDirectory>
<overWriteReleases>true</overWriteReleases>
<overWriteSnapshots>true</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
For a DLL, you will need to use the Copy Dependencies MOJO.
You can filter out all dependencies other than the DLL and specify anywhere in your project structure to copy them to, including your target/webapp/WEB-INF/lib.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With