我正在尝试在garils-app/store上向我的 war 添加一个目录(BuildConfig.groovy)。

grails.war.resources = {stagingDir,args->
    copy(file: "grails-app/store/**", toFile: "${stagingDir}/store")
}

但是,当我尝试构建war文件时,出现此错误:
| Error WAR packaging error: Warning: Could not find file /home/codehx/git/appName/grails-app/store/** to copy

好像grails没有将**视为通配符,我有什么错误吗?或者,如果不可能,如何将store dir的内容递归复制到我的war文件中。

最佳答案

鉴于grails.war.resourcesAntBuilder,您可以使用任何适当的AntBuilder表达式来包含其他资源。在较旧版本的AntBuilder中,**表示法确实有效,但在较新版本的AntBuilder中,首选方法是:

grails.war.resources = { stagingDir, args ->
    copy(todir: "${stagingDir}/store") {
        fileset(dir: "grails-app/store")
    }
}

07-25 22:11
查看更多