简体   繁体   中英

How to use Maven to handle a cross-platform (Windows + Linux) Java Native Interface Project?

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM