How to write a Tear down groovy script with maven dependent classes

Sourabh25Sourabh25 Posts: 37
edited March 22 in SOAtest


I have a tear down script which is as below:

From Soatest perspective if i add the java project in the system properties, it identifies the jar files and the groovy script execute fines.

But how can I do it from Java perspective with a maven command. For instance, in the above code LoggerMainImpl class is the one I am getting from the maven dependency.



  • benken_parasoftbenken_parasoft Posts: 421 ✭✭✭
    edited March 22

    Can you please see the earlier response from @jakubiak?

    When driving test execution from soatestcli or from the Parasoft maven plugin, you must specify jars in your file. There is no option to automatically pick up jars from dependencies in a maven pom.xml. However, without listing jars in the file, SOAtest will automatically pick up any jars added to any /TestAssets/system_jars folder in the workspace.

    In case this helps, if you would like to dump all the dependencies (including transitive ones) to a folder then you can run a maven command like this:
    mvn dependency:copy-dependencies -DincludeScope=runtime -DoutputDirectory=system_jars

  • Sourabh25Sourabh25 Posts: 37

    Thanks @benken_parasoft and @jakubiak . I followed that i need to add the path of the jars in the localsettings file.
    Now the next question is can we make this path generic so that with maven command i can execute it on any machine? Kindly let me know if this can be done.

  • benken_parasoftbenken_parasoft Posts: 421 ✭✭✭
    edited March 23

    Now the next question is can we make this path generic so that with maven command i can execute it on any machine?

    You can use variables in the paths in your localsetings file, including one called "env_var" which can reference shell/environment variables. For example, ${env_var:HOME}/path/to/somejar.jar. Some are described in Using Variables in Preference Settings.

    Alternatively, I've also seen users have a localsettings property file that is a template, where they use a little script to perform their own string/token replacements to generate the final version with final values/paths injected as a step prior to executing soatestcli.

  • Sourabh25Sourabh25 Posts: 37


    I tried the suggestions given in the above comment but i could not implement it. Please see below the requirement.

    I am able to point to the files using the below entries in the localsettings\Users\!username\parasoft\workspace\dynamite\Automation_Code;C:\Users\username\.m2\repository\com\abc\selenium\logtransactions\1.6-SNAPSHOT\logtransactions-1.6-SNAPSHOT.jar

    However, when I am attempting to parametrize it using the below entries${project_loc}\..\dynamite\Automation_Code;${env_var:USERPROFILE}\.m2\repository\com\abc\selenium\logtransactions\1.6-SNAPSHOT\logtransactions-1.6-SNAPSHOT.jar
    it is not working.

    Could someone please let me know what I am doing wrong here

  • benken_parasoftbenken_parasoft Posts: 421 ✭✭✭
    edited March 27

    "project_loc" takes a parameter. For example, ${project_loc:NameOfMyProject}. The name of your project should appear in the .project file next to the pom.xml

    Please also recall that this is a java properties file where backslash is an escape character. Any backslashes in file paths need to be escaped with an extra backslash. Alternatively, using forward-slash in file paths instead of backslash also generally works.

  • Sourabh25Sourabh25 Posts: 37
    edited March 28

    Thanks a lot @benken_parasoft . With implementing the above comments, it is working.

Sign In or Register to comment.