Forum Discussion

andrew_laser's avatar
andrew_laser
Occasional Contributor
15 years ago

projectDir variable doesn't work in Load Script

Need to find out the full path to the project file in the project "Load Script"
The following don't work:

log.info project.getPropertyValue("projectDir")


// null


log.info "${projectDir}"


groovy.lang.MissingMethodException: No signature of method: Script12.$() is applicable for argument types: (Script12$_run_closure1) values: [Script12$_run_closure1@244da55d] Possible solutions: is(java.lang.Object), run(), run(), any(), use([Ljava.lang.Object;), any(groovy.lang.Closure)


log.info ${"#Project#projectDir"}

groovy.lang.MissingMethodException: No signature of method: Script14.$() is applicable for argument types: (Script14$_run_closure1) values: [Script14$_run_closure1@dd55e06] Possible solutions: is(java.lang.Object), run(), run(), any(), use([Ljava.lang.Object;), any(groovy.lang.Closure)


After setting Project Root = ${projectDir}
log.info project.getResourceRoot()


${projectDir}


Using soapUI 4.0.1

1 Reply

  • andrew_laser's avatar
    andrew_laser
    Occasional Contributor
    The only way I found was

    sFullProjectPath = project.getPath() //Get full path to the project file (including file name)
    sProjectDir = sFullProjectPath.replaceAll(/([^\\]+\.\w+)/, "") //remove file name from the string