构建 war 时如何包含额外文件?
How to include extra files when building a war?
我想在我的 BuildConfig.groovy
上像这样向我的 war 添加一个目录 (garils-app/store
)。
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
目录的内容复制到我的 war 文件中。
鉴于 grails.war.resources
是一个 AntBuilder
,您可以使用任何适当的 AntBuilder
表达式来包含其他资源。在旧版本的 AntBuilder
中,**
符号确实有效,但在更高版本的 AntBuilder
中,首选方法是:
grails.war.resources = { stagingDir, args ->
copy(todir: "${stagingDir}/store") {
fileset(dir: "grails-app/store")
}
}
我想在我的 BuildConfig.groovy
上像这样向我的 war 添加一个目录 (garils-app/store
)。
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
目录的内容复制到我的 war 文件中。
鉴于 grails.war.resources
是一个 AntBuilder
,您可以使用任何适当的 AntBuilder
表达式来包含其他资源。在旧版本的 AntBuilder
中,**
符号确实有效,但在更高版本的 AntBuilder
中,首选方法是:
grails.war.resources = { stagingDir, args ->
copy(todir: "${stagingDir}/store") {
fileset(dir: "grails-app/store")
}
}