如何从Maven repo引用本机DLL? [英] how to reference native DLL from Maven repo?

查看:143
本文介绍了如何从Maven repo引用本机DLL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果JAR附带了Maven repo中的本机DLL,我需要将哪些内容放入我的pom.xml以将该DLL放入包装中?

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更具体地说,例如 Jacob 图书馆。你怎么做 jacob-1.14.3-x64.dll 进入 WEB-INF / lib 文件夹后运行 mvn包

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?

在我们的本地Nexus存储库中,我们有JAR和DLL的这些定义:

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>

但是将相同的依赖项放到我们的项目POM并运行 mvn package 不会让DLL进入 WEB-INF / lib ,但JAR可以很好地使用。

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.

我们做错了什么?

推荐答案

对于DLL,您需要使用复制依赖关系MOJO

For a DLL, you will need to use the Copy Dependencies MOJO.

您可以过滤除DLL之外的所有依赖项,并指定项目结构中的任何位置以将其复制到目标/ webapp / WEB-INF / lib。

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.

这篇关于如何从Maven repo引用本机DLL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆