cancel
Showing results for 
Search instead for 
Did you mean: 

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

SOLVED
Highlighted
Contributor

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.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Contributor

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

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?

5 REPLIES 5
Contributor

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

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?

Contributor

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

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 

Contributor

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

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?

Contributor

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

I built the jar from java code. I included the depenencies in the jar file. The groovy script is finding the class, but cannot initialize it

Community Manager

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

Thanks for the assistance, @JustinM89.

 

@lauravachon, if the issue wasn't resolved, could you please refer it to our ReadyAPI Support Team?

---------
Tanya Gorbunova
SmartBear Community Manager

Join the September Hub-bub to show off, learn and win
New Here?
Join us and watch the welcome video:
Join the exciting event
SeptemberHubBub
Top Kudoed Authors
Join the September Hub-bub to show off, learn and win