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.
Typically, war files don't contain war files. They can contain jar files; that's what the directory WEB-INF/lib is for.
To create war file, you need to use jar tool of JDK. You need to use -c switch of jar, to create the war file. Go inside the project directory of your project (outside the WEB-INF), then write the following command: jar -cvf projectname.
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")
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With