如何使用 Maven 处理跨平台(Windows + Linux)Java Native Interface 项目?

发布于 2024-08-20 20:54:37 字数 297 浏览 4 评论 0原文

我目前正在尝试开发一个跨平台解决方案,该解决方案将使一些尚未属于 java 标准库的 UI 组件可用于我的 java 代码。我正在为 X11 编写 xlib 代码,并使用适用于 Windows 的相关 win32 api。

是否可以(甚至推荐?)使用 Maven 设置 java 和 c 代码构建系统?我需要一个构建系统来编译和链接 X11 代码,编译和链接 win32 代码,并将它们与 java 接口代码一起打包在 jar 中。我应该使用 Ant 来做到这一点吗?

我以前使用过这两种构建工具,但我不知道哪一个被认为是 JNI 代码的推荐工具。

I am currently trying to develop a cross-platform solution that will make some UI components that are not already part of the java standard library available to my java code. I am writing xlib code for X11 and using the relevant win32 api's for windows.

Is it possible (or even recommended?) to setup a java and c code build system using Maven? I need a build system that will compile and link the X11 code and compile and link the win32 code and package them in the jar along with the java interface code. Should I be using Ant to do this?

I have used both build tools before but I don't know which is considered the recommended tool for JNI code.

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

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

发布评论

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

评论(2

2024-08-27 20:54:37

使用 native-maven-plugin。我将创建一个多模块 Maven 项目,为每个本机接口提供单独的模块。

It is certainly possible using the native-maven-plugin. I would create a multi-module maven project with separate modules for each of the native interfaces.

不再见 2024-08-27 20:54:37

这是可能的并且没有禁忌。我会使用 Native Maven 插件 或 < a href="http://mojo.codehaus.org/cbuild-parent/cbuild-plugin-parent/make-maven-plugin/index.html" rel="nofollow noreferrer">Makefile 编排插件(如果你有一个现有的makefile),带有特定的模块或配置文件对于每个目标平台。

It is possible and not contraindicated. I would use the Native Maven Plugin or the Makefile Orchestration Plugin (if you have an existing makefile), with specific modules or profiles for each targeted platform.

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