gpt4 book ai didi

gradle - 使用$ buildDir.parent时,Gradle复制方法不起作用

转载 作者:行者123 更新时间:2023-12-03 03:06:13 25 4
gpt4 key购买 nike

在集成测试之前,我需要执行复制任务,这就是我的工作方式。

    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 test时控制台上的输出:

输出:项目目录为C:\ Users \ xxx \ git \ xyz \ xyz \ xxx

但是,当我运行测试任务时,文件不会被复制

请帮忙!

最佳答案

解决了!我使用的单引号不支持字符串插值。

引用:Peter niederwieser在Gradle Single vs Double Quotes

关于gradle - 使用$ buildDir.parent时,Gradle复制方法不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40537995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com