Hi everyone,
I'm currently developing a custom Ignition module using the scripting-function Maven project as a base. In my module.xml
file, I'm including third-party libraries like so:
<jar scope="DG">msal4j-1.20.1.jar</jar>
According to( The module.xml File | Ignition SDK Programmer's Guide) there's an <export>
tag that can be used to make JARs available to a higher classloader
However, I'm not sure how to properly configure this in my maven-based build so that the required JARs are both:
- packaged in the
.modl
file, and
- included in the
<export>
section of the module.xml
.
Are there any examples or best practices for automatically generating the <export>
entries?
Thanks in advance!
I still use ant
to build my modules, so I can't help you with maven or gradle. But I use this in my Integration Toolkit module if you'd like an example of how it is supposed to turn out.
The current Maven module plugin doesn't have any way to set a dependency as export
that I can see:
Sure, could you provide the module?
Thanks! may i ask a further question: it says that with the export tag the dependencies are available in a higher classloader, which classloader does this refer to and in which context are those dependencies accessible? My original goal was to make msal4j.jar
available to the database classloaders, but I assume that’s not feasible using export
or generally with a module, correct?
Not sure. I thought it was the root classloader.
It's a separate ClassLoader that sits between modules and the root/context ClassLoader.
I don't think so; JDBC drivers are in their own isolated ClassLoader.
1 Like
Something like this I think:
1 Like
Then scripting must run from that modules classloader, as exported classes are directly accessible in gateway scripts.
I mean, modules can run arbitrary code. The JDBC classloader just picks up whatever jars are in the jdbc/
folder. Nothing's stopping you from just dropping your own JAR there other than the prospect of having to clean it up eventually.
1 Like
Another trick you can do is just add an additional classpath entry to ignition.conf
, e.g.
wrapper.java.classpath.3=lib/core/custom
and drop any extra JAR files you want in there.
edit: though I'm not sure that's the right place for JDBC hackage...