For the module that I am developing, I need to include third-party libraries in a directory where they can be accessed by Ignition. The only way I have been able to do this so far is to copy those libraries into in the /usr/local/bin/ignition/lib folder on my Linux machine. However, when I update Ignition that folder is overwritten, which means I need to copy the libraries again. Is there a way add an additional path to the list of directories that Ignition checks for library files?
There is, by modifying ignition.conf, but it only works for Gateway-scoped dependencies. Is that enough?
If the third-party modules are appropriately licensed (and you include any corresponding acknowledgements in your module's own EULA), then you can package them inside your module. And upgrades won't smash your kit.
You can also use your module hook's own classloader, use reflection to obtain its .addJarFile()
method, and dynamically load just about anything. If you go this route, you have to take care that your classes that directly reference any of its content are only referenced indirectly by Ignition's module lifecycle methods.
Thanks all! I've figured out how to include the .jar
libraries in the module, but the issue here is that the .jar
libraries require some .so
(or .dll
if on Windows) libraries to be available at runtime - these are the libraries that I need to include in the lib
folder.
Include them with your module and extract them on startup. You're on your own there, no built in mechanism.
They'll have to land in one of the folders defined by the system property java.library.path
. Like the class path, this can be modified in ignition.conf.