在构建战争时如何包含额外的文件? [英] How to include extra files when building a war?
问题描述
我试图在我的 BuildConfig.groovy $ c中添加一个dir(
garils-app / store
)到我的战争中$ C>。
grails.war.resources = {stagingDir,args->
copy(file:grails-app / store / **,toFile:$ {stagingDir} / store)
}
但是当我尝试构建war文件时,出现此错误:
|错误WAR包装错误:警告:无法找到文件/ home / codehx / git / appName / grails-app / store / **来复制
。
看起来grails并没有将 **
视为通配符,我是否有任何错误?或者,如果这是不可能的,我怎么能递归复制存储
目录的内容到我的war文件。
AntBuilder
,你可以使用任何正确的 AntBuilder
表达式包含额外的资源。在较旧版本的 AntBuilder
中, **
表示法确实有效,但在更高版本的 AntBuilder
首选的方法是: grails.war.resources = {stagingDir,args - >
copy(todir:$ {stagingDir} / store){
fileset(dir:grails-app / store)
}
}
I am trying to add a dir (garils-app/store
) to my war like this on my BuildConfig.groovy
.
grails.war.resources = {stagingDir,args->
copy(file: "grails-app/store/**", toFile: "${stagingDir}/store")
}
But when I try to build the war file I am getting this error:
| Error WAR packaging error: Warning: Could not find file /home/codehx/git/appName/grails-app/store/** to copy
.
It looks like grails is not considering the **
as wild cards, am I having any error? Or if it is not possible how can I recursively copy the content of store
dir to my war file.
Given that the grails.war.resources
is an AntBuilder
you can use any proper AntBuilder
expressions to include additional resources. In older versions of AntBuilder
the **
notation did work, but in later versions of AntBuilder
the preferred method is:
grails.war.resources = { stagingDir, args ->
copy(todir: "${stagingDir}/store") {
fileset(dir: "grails-app/store")
}
}
这篇关于在构建战争时如何包含额外的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!