When I upload this pdfbox-2.0.13.jar in Resources, it doesn't work. I cannot figure why.
My groovy script always failed on the line:
import org.apache.pdfbox.pdmodel.PDDocument
with this message 'cannot resolv class'.
I also notice that the automatic completion does not work when I am editing.
For Instance, the autocompletion should suggest several methods, like this one :
PDDocument.load()
So I upgraded my Bonita Studio and I tested a script with a completely different jar file in Resources : commons.math3-3.6.1.jar
This time, the behaviour is correct. Autocompletion and execution are fine.
I suspect that my pdfbox jar is not accepted, maybe because it depends on others libs but I can't find what they are. So I run the same script outside Bonita, in Visual Studio Code, and the script runs fine because Grab() gets all the dependencies needed.
In 2021.2 the dependency mechanism has been updated to use maven under the hood.
It means that you should not have to take too much care of guessing what transitive dependencies are required for a given dep.
The easiest way to add a dependency to a process (or a script used in that process) is to go in the project Overview > Extension view. Then you click on Add a custom extension > other…
From there, you can select the proper maven coordinate for your dependency (this dependency must be available on Maven Central or whatever remote repository you have configured).
So in your case, it is something like:
groupId: org.apache.pdfbox
artifactId: pdfbox
version: 2.0.13
Then in the process configuration of your process, navigate to Process dependencies > Other > Add... and select pdfbox-2.0.13. It should add pdfbox and its transitive dependencies in your process class-path.
Bonitasoft empowers development teams with Bonita, the open-source and extensible platform to solve the most demanding process automation use cases. The Bonita platform accelerates delivery of complex applications with clear separation between capabilities for visual programming and for coding. Bonita integrates with existing solutions, orchestrates heterogeneous systems, and provides deep visibility into processes across the organization.