2016-11-10 52 views
0

我需要在集成測試之前執行復制任務,這就是我的做法。

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' 

      } 
     } 

下面是在控制檯上的輸出,當我運行gradle這個測試:

輸出:項目目錄爲-C:\用戶\ XXX \ git的\某某\某某\ XXX

然而當我運行測試任務時,文件沒有被複制

請幫忙!

+0

彼得niederwieser您AR談論的文件,但你只是想複製一個文件xx.xml。這是對的嗎? –

+0

我在doFirst中有很多複製方法,但它們都是類似的複製方法,所以我只是爲了方便閱讀而發佈了其中一種方法。 – SuryaVal

+0

@SanDroid更正! – SuryaVal

回答