How to create maven artifact for different platforms, i.e. needs system libraries
I have a JAR file which I want to add to my maven 2 repository as an artifact. The JAR depends on system libraries specific for each platform, e.g. .dll on Windows, .so on Linux, etc.
How should I create the artifact so that users from different platforms can use the JAR?
If your JAR is a library that you expect to be included into other projects, then you can create maven profiles that can be activated based on a system and add whatever required system dependencies there.
<profiles> <profile> <activation> <os> <name>Windows XP</name> <family>Windows</family> <arch>x86</arch> <version>5.1.2600</version> </os> </activation> ... </profile> </profiles>
However, if you are making an executable JAR then it's quite a different story.
There are many ways you can do this, not all are easy. If you know what you are looking for ( name of a DLL or SO lib ), then you could make a startup script to:
- Try finding one in the class path
- Try finding one in the system path
- Try finding one in "default" / "most expected" location(s)
- Search for a .config file having the file location
- Ask user to enter the path to the file
Some apps do all all of these steps, some do a few or just one. I would like to know if there is a better way too :)