Forum Discussion

hb's avatar
Occasional Contributor
6 years ago

use filelist across projects groovy scripts

I have two projects, groovyscriptsLibrary and second project is uploadbinding, there is a step in first project that reads the list of xml files and sets it into the context. 


I am calling the step as part of second project. and want to use that filelist 

fileListScript:- project1

def fileList = []
def requestFileLocation = context.expand( '${#Global#RequestFilePath}' )
new File(requestFileLocation).eachFile { f ->
if (f.isFile()&&'.xml'))
def filename =[0..-1]
fileList.add(filename) filename



second script in project2;

def requestFileLocation = context.expand( '${#Global#RequestFilePath}' )
File file = new File(requestFileLocation +"\\"+ context.get('fileList').last())


filelist object is coming as null. I have tried to call the filelistscript from project2 as well the object is still null. is there a way i could use this across projects?

1 Reply

  • hb's avatar
    Occasional Contributor

    I was able to solve this. and had the scripts to work.


    thank you