Forum Discussion

lauravachon's avatar
lauravachon
Contributor
6 years ago

How can I include dependencies from an external jar file into a groovy script test step

Hello Community,

 

I am using the ready-api maven plugin. I have my dependency in the pom.xml. The depedency is being downloaded. My question is how can I use the classes in this jar file in a groovy test step.

 

I have tried using an import statement, but the script does not know where to locate the jar.

 

As a side note, we do not have admin rights on our local machines so I cannot install the jar file to the soapUi install directory. So, I need a way to tell SoapUi how to find the Jar file.

 

I pulled my code out into intelliJ and it works, but I cannot get it to work inside of soapUi.

 

  • Within ReadyAPI, you can go to Preferences > ReadyAPI, and there is a "Custom Java libraries" section where you can point to JARs and folders, I think this may be what you're looking for. But just to clarify, you want to access classes from the readyapi-maven-plugin JAR in your Groovy scripts?

  • Within ReadyAPI, you can go to Preferences > ReadyAPI, and there is a "Custom Java libraries" section where you can point to JARs and folders, I think this may be what you're looking for. But just to clarify, you want to access classes from the readyapi-maven-plugin JAR in your Groovy scripts?

    • lauravachon's avatar
      lauravachon
      Contributor

      Thank you so much. I updated that setting. The tool is able to find my class, but cannot initialize it.

       

      java.lang.NoClassDefFoundError: Could not initialize class

       

      Any ideas?

       

      Thanks for the tip on how to specify the location of the jar file JustinM89 

      • JustinM89's avatar
        JustinM89
        Contributor

        Hm, unfortunately I won't be of much help here as I don't know too much about class loading, but I think the issue is with the JAR itself -- what specific class are you trying to use?