vpachpute1
8 years agoFrequent Contributor
Groovy : How to give absolute file path of file.
Hi I want to give absolute file path in Groovy. I have following code. // Option 1 : this works on my local. but not on Jenkins/maven which is on server. As there is relative path of my local...
- 8 years agoSince the path changes machine to machine, you need to use a variable / project level property, say BASE_DIRECTORY, set this value according to machine, here "/home/vishalpachupute" and rest of the path maintain the directory structure for the resources being used.
In the script:
def prefix = context.expand('${#Project#BASE_DIRECTORY}')
def request = new File("${prefix}/API/Responses/Response_SelfFullTrans.xml").text