Reputation: 165
This is a very simple question really but I am having to pull my hair over it.
In Gradle, I am having to copy some files in my project to a location outside the project - /var/tmp/a_particular_folder/
The target path will remain the same on both Windows and Linux boxes.
So my task looks like this:
task copyFilesNeededForTests(type: Copy) {
from 'src/testconfiguration/'
into '/var/tmp/a_particular_folder'
}
But that does not work! It copies the files relative to the root project's path.
I've tried a lot of things:
Any clues anybody of how to copy into a filesystem folder relative to the root of the filesystem?
Edit: Using version 2.8
Upvotes: 1
Views: 2057
Reputation: 165
Answering myself.
I managed to solve this problem by using:
into new File('/var/temp/my_particular_folder').absolutePath
Note the 'new File()' and then 'absolutePath' on it. Works on Windows, Linux, Mac.
Upvotes: 4