使用Maven管理本机库 [英] Managing native libraries with Maven

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

问题描述

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

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

我们使用了一些依赖于外部本机lib的jar,因此我正在寻找某种方式来使它们变质.

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

谢谢.

推荐答案

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

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>

然后,用 maven-dependency-plugin unpack-dependencies mojo.

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

还请查看以下先前的答案, a href ="http://www.humboldt.co.uk/2009/02/wrapping-a-native-library-with-maven.html" rel ="nofollow noreferrer">用Maven包装本机库帖子和 5.5.3.部分. Maven的平台分类器:完整参考

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,

这篇关于使用Maven管理本机库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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