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.

        <name>Windows XP</name>

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:

  1. Try finding one in the class path
  2. Try finding one in the system path
  3. Try finding one in "default" / "most expected" location(s)
  4. Search for a .config file having the file location
  5. 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 :)

Need Your Help

Laravel Auth:attempt() will not persist login

php authentication laravel laravel-4

I have found many resources online with similar issues but none of the solutions appear to solve my problem.