dsharew
dsharew

Reputation: 10665

How to include extra files when building a war?

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.

Upvotes: 6

Views: 1542

Answers (1)

Joshua Moore
Joshua Moore

Reputation: 24776

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")
    }
}

Upvotes: 6

Related Questions