2

I need to execute a copy task before an integration test and this is how I am doing it.

    println "project dir is" +  "${buildDir.parent}"//this line prints the path of the directory fine when i run the script

    //here is my copy method which needs to run before the test task
    test.doFirst {
        copy {
            from '${buildDir.parent}/test/xx.xml'

            into '${buildDir.parent}/build/classes/test'

             }
        }

Below is the output on the console when I run gradle test:

Output: the project directory isC:\Users\xxx\git\xyz\xyz\xxx

However when I run the test task the file is not getting copied

Please help!

SuryaVal
  • 148
  • 1
  • 1
  • 9

1 Answers1

4

Solved! I was using single quotes which don't support string interpolation.

Reference: by peter niederwieser at Gradle Single vs Double Quotes

Community
  • 1
  • 1
SuryaVal
  • 148
  • 1
  • 1
  • 9