Forum Discussion

chris12345's avatar
chris12345
Visitor
3 years ago
Solved

Setting relative script library path

Hi,

 

we are working with multiple ReadyAPI projects, each using a different scripting library path.

Team members have different locations where the projects are located. So we avoid absolute paths.

 

How can we set relative scripting paths for projects?

 

One attempt was to set "Script Library" in project properties: ${=Paths.get(project.path).getParent().toString() + "\\Scripts"}

 

 

However this results in following stackoverflow error:

 

 

<init>(SoapUIProGroovyScriptEngineFactory.java:145)
        at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory.createScriptEngine(SoapUIProGr
oovyScriptEngineFactory.java:60)
        at com.eviware.soapui.support.scripting.SoapUIScriptEngineRegistry.create(SoapUIScriptEngineRegistry.java:56)
        at com.eviware.soapui.support.scripting.SoapUIScriptEngineRegistry.create(SoapUIScriptEngineRegistry.java:52)
        at com.eviware.soapui.support.scripting.ScriptEnginePool.getScriptEngine(ScriptEnginePool.java:59)
        at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:15
4)
        at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolve
r.java:149)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:213)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:156)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:152)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:148)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:257)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:261)
        at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProProjectGroovyClassLoa
der.getScriptsFolder(SoapUIProGroovyScriptEngineFactory.java:154)
        at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyClassLoader.syncExternalClasses(SoapUIGroovyClassLoad
er.java:80)
        at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProProjectGroovyClassLoa
der.<init>(SoapUIProGroovyScriptEngineFactory.java:145)
        at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory.createScriptEngine(SoapUIProGr
oovyScriptEngineFactory.java:60)
        at com.eviware.soapui.support.scripting.SoapUIScriptEngineRegistry.create(SoapUIScriptEngineRegistry.java:56)
        at com.eviware.soapui.support.scripting.SoapUIScriptEngineRegistry.create(SoapUIScriptEngineRegistry.java:52)
        at com.eviware.soapui.support.scripting.ScriptEnginePool.getScriptEngine(ScriptEnginePool.java:59)
        at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.doEval(EvalPropertyResolver.java:15
4)
        at com.eviware.soapui.model.propertyexpansion.resolvers.EvalPropertyResolver.resolveProperty(EvalPropertyResolve
r.java:149)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:213)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:156)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:152)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:148)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expand(PropertyExpander.java:257)
        at com.eviware.soapui.model.propertyexpansion.PropertyExpander.expandProperties(PropertyExpander.java:261)
        at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProProjectGroovyClassLoa
der.getScriptsFolder(SoapUIProGroovyScriptEngineFactory.java:154)
        at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyClassLoader.syncExternalClasses(SoapUIGroovyClassLoad

 

 

 

  • Hello chris12345 

     

    Maybe try a different syntax for setting the value...

     

    Instead of setting "Script Library" in project properties to

    ${=Paths.get(project.path).getParent().toString() + "\\Scripts"}

     

    How about setting "Script Library" in project properties to 

    ${projectDir}/Scripts/

     

    Regards,

    Todd

     

  • kitaitoa's avatar
    kitaitoa
    2 years ago

    Hi,

     

    I tried to set this property with the same value, but i's not functionaly in my project.

    did you (@chris12345 or TNeuschwanger) set another property ?

    I have this error: (my class is not found)

     

    Tue Aug 30 16:52:55 CEST 2022: ERROR: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    Script2.groovy: 1: unable to resolve class cxuRandomArbitrary
     @ line 1, column 1.
       import cxuRandomArbitrary; 
       ^
    org.codehaus.groovy.syntax.SyntaxException: unable to resolve class cxuRandomArbitrary
     @ line 1, column 1.
    	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:262)
    	at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1434)
    	at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:262)
    	at org.codehaus.groovy.control.CompilationUnit.lambda$new$16(CompilationUnit.java:738)
    	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:901)
    	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
    	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
    	at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
    	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
    	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
    	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
    	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
    	at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
    	at groovy.lang.GroovyShell.parse(GroovyShell.java:570)
    	at groovy.lang.GroovyShell.parse(GroovyShell.java:565)
    	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.recompileWithNewName(SoapUIGroovyScriptEngine.java:158)
    	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:149)
    	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94)
    	at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:98)
    	at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:159)
    	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:302)
    	at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:53)
    	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:192)
    	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:1)
    	at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:130)
    	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
    	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
    	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
    	at java.base/java.lang.Thread.run(Thread.java:833)
    
    1 error
    
       org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
       Script2.groovy: 1: unable to resolve class cxuRandomArbitrary
        @ line 1, column 1.
          import cxuRandomArbitrary; 
          ^

     

    thanks

6 Replies

  • TNeuschwanger's avatar
    TNeuschwanger
    Champion Level 2

    Hello chris12345 

     

    Maybe try a different syntax for setting the value...

     

    Instead of setting "Script Library" in project properties to

    ${=Paths.get(project.path).getParent().toString() + "\\Scripts"}

     

    How about setting "Script Library" in project properties to 

    ${projectDir}/Scripts/

     

    Regards,

    Todd

     

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thanks for the idea TNeuschwanger!

       

      Hi chris12345! Was the advice helpful?  

    • kitaitoa's avatar
      kitaitoa
      Contributor

      Hi,

       

      I tried to set this property with the same value, but i's not functionaly in my project.

      did you (@chris12345 or TNeuschwanger) set another property ?

      I have this error: (my class is not found)

       

      Tue Aug 30 16:52:55 CEST 2022: ERROR: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      Script2.groovy: 1: unable to resolve class cxuRandomArbitrary
       @ line 1, column 1.
         import cxuRandomArbitrary; 
         ^
      org.codehaus.groovy.syntax.SyntaxException: unable to resolve class cxuRandomArbitrary
       @ line 1, column 1.
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.addError(ClassCodeVisitorSupport.java:262)
      	at org.codehaus.groovy.control.ResolveVisitor.visitClass(ResolveVisitor.java:1434)
      	at org.codehaus.groovy.control.ResolveVisitor.startResolving(ResolveVisitor.java:262)
      	at org.codehaus.groovy.control.CompilationUnit.lambda$new$16(CompilationUnit.java:738)
      	at org.codehaus.groovy.control.CompilationUnit$ISourceUnitOperation.doPhaseOperation(CompilationUnit.java:901)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:627)
      	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:389)
      	at groovy.lang.GroovyClassLoader.lambda$parseClass$3(GroovyClassLoader.java:332)
      	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.compute(StampedCommonCache.java:163)
      	at org.codehaus.groovy.runtime.memoize.StampedCommonCache.getAndPut(StampedCommonCache.java:154)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:330)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:526)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:538)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:570)
      	at groovy.lang.GroovyShell.parse(GroovyShell.java:565)
      	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.recompileWithNewName(SoapUIGroovyScriptEngine.java:158)
      	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.compile(SoapUIGroovyScriptEngine.java:149)
      	at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:94)
      	at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:98)
      	at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:159)
      	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:302)
      	at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:53)
      	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:192)
      	at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:1)
      	at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:130)
      	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
      	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.base/java.lang.Thread.run(Thread.java:833)
      
      1 error
      
         org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
         Script2.groovy: 1: unable to resolve class cxuRandomArbitrary
          @ line 1, column 1.
            import cxuRandomArbitrary; 
            ^

       

      thanks

      • TNeuschwanger's avatar
        TNeuschwanger
        Champion Level 2

        Hello kitaitoa 

         

        No other properties were set.  You might have to hard code the property with what you think it should be to see if you can find your class as a debug attempt.  I don't know what the issue could be other than a mismatch of where you put the class files and the path ReadyAPI is using.

         

        Regards,

        Todd