I would recommend creating a fat jar that has precisely what you need and referencing that. That's a pattern my team's been using for a while to get near custom NAR functionality through ExecuteScript. Here's an overview of what it looks like:
https://mikethomsen.github.io/posts/2020/11/06/taking-executescript-to-the-next-level-with-fat-jars You should be able to copy and paste the Maven pom.xml and update it to match your needs pretty easily. Make sure to configure any NiFi api jars as "provided" scope. On Tue, Nov 17, 2020 at 7:23 AM Piper, Nick <[email protected]> wrote: > > I've implemented a groovy ScriptedReader , and wish to reuse jar libraries > which are already part of NiFi from my script. > > https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-scripting-nar/1.5.0/org.apache.nifi.record.script.ScriptedReader/index.html > > The script can be seen at > https://gist.github.com/pipern/2d67fbc0a4225cf1b42d1fff832c2c54 > > My script needs some of the 'jar files' which are present in > nifi-standard-nar. Is there a way I can reuse those already inside that nar > file? Otherwise I'll have to unpack the nar, place the jar files in some > other folder, and refer to that folder in 'Module Directory' - on every > machine in the NiFi cluster. I'm looking for maybe some way to have my goovy > script use a different classloader (?) or somehow reuse the existing jar > files inside that nar file. Maybe it would be reliable to predict the 'work' > folder and look for unpacked nar files in there... > > Many thanks, > > Nick
