How to create text file using Groovy?
Just an addition to the accepted answer--if you want to create a file with content, you can do this:
new File("C:/Users/ramus/Documents/Jars/test.txt").text = "Test text file content"
This particular feature is one of my favorite parts of groovy, you can even append to a file with +=
new File(path) means create pointer to file or directory with selected path. Using this pointer you can do anything what you want create, read, append etc. If you wish to only create file on drive you can do:
def newFile = new File("C:/Users/ramus/Documents/Jars/test.txt")
newFile.createNewFile()