使用 Maven 管理本机库

发布于 2024-08-24 10:17:56 字数 97 浏览 2 评论 0原文

是否可以在maven下管理本机库(.so)?

我们使用一些依赖于外部本机库的 jar,因此我正在寻找某种方法来对它们进行 mavenize。

谢谢。

Is it possible to manage native libraries (.so) under maven?

We use some jars with dependences on external native libs, so I'm looking for some way to mavenize them.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

肩上的翅膀 2024-08-31 10:17:56

我认为“常见”方法是使用分类器(例如 mylib-1.2.3-solaris.jar)将本机库捆绑在特定于平台的 JAR 中,您可以像任何其他带有分类器的 JAR 一样依赖它:

<dependency>
  <groupId>my.group</groupId>
  <artifactId>mylib</artifactId>
  <version>1.2.3</version>
  <classifier>solaris</classifier>
</dependency>

然后,使用 maven-dependency-pluginunpack-依赖项 mojo。

另请查看之前的答案包装原生带有 Maven 的库 帖子和部分 5.5.3。 Maven 的平台分类器:完整参考

I think that the "common" approach is to bundle the native libraries in platform specific JARs using classifiers (e.g. mylib-1.2.3-solaris.jar) on which you could depend like any other JAR with classifier:

<dependency>
  <groupId>my.group</groupId>
  <artifactId>mylib</artifactId>
  <version>1.2.3</version>
  <classifier>solaris</classifier>
</dependency>

And then, unpack them with the maven-dependency-plugin and the unpack-dependencies mojo.

Also have a look at this previous answer, the Wrapping a Native Library with Maven post and the section 5.5.3. Platform Classifiers of the Maven: the complete reference,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文