Import 3rd party jars into CloverDX

Hi all,
As we know, when you’re using java related components, like CustomJavaReader, you probably need to import some 3rd party jars. Instead of adding the jar file on the classpath explicitly (in CloverDX Designer right click / Project / Java Build Path / Libraries), can we use Maven (or Gradle) to manage these Jar files? Because the jar file you imported may depend on other Jars as well.

Hi,

Even though there is no native support for these tools in CloverDX software, you can use them externally to import all the dependencies. You need to have a pom.xml file which is used to download the libraries in a Maven project, containing all the needed dependencies. The idea is to use this pom.xml and a script that would use Maven CLI tool to download the libraries and their dependencies for you.

As I mentioned, you need to provide the pom.xml. Attached is a simple script that uses the Maven CLI to download the libraries. Copy the attached script file and the pom.xml into the root of your project. By running the scrip file you’ll download the libraries into the lib folder of your project. The last thing to do is to add the libraries on the classpath by navigating into the Properties of your project → Java Build Path → Libraries → Add JARs… and select all the jars in your lib folder.

Please note the script will only work if you have Apache Maven installed on your system. Also, if you’re on Linux, you’ll need to adapt the script accordingly.

Best regards.

Hi Lukas,
Thanks for your reply. I am working on a Macbook. Could you share with me some screenshots of how to use the download_libraries script to import relative jars? Thanks in advance.

Hi,

I’m not sure what screenshots I can provide to be of any help as I’m not working on a MacOS X machine so there would be great differences in the usage of the script. If you have issues with adapting the script to MacOS, as far as I know, you should be only required to add “#!/bin/sh” as the very first line of the script file and change its suffix to “.sh”. Then you just run it via command line. Other details on the usage are in my previous response. Unfortunately, this workaround goes beyond the CloverDX software itself and as such it is not officially supported. However, if you have any issues using it, we will try to be as helpful as possible. If you have any technical issues with the Maven software, please refer to the Maven documentation.

Best regards.

Great topic! Excellent answers. Got solution. Thank you for the answers.