The Grails documentation on deployment talks about this. The two configuration options available to you are grails.war.copyToWebApp and grails.war.resources. The first of these lets you customise what files are included in the WAR file from the "web-app" directory. The second lets you do any extra processing you want before the WAR file is finally created.
BuildConfig.groovy
// This closure is passed the command line arguments used to start the
// war process.
grails.war.copyToWebApp = { args ->
fileset(dir:"web-app") {
include(name: "js/**")
include(name: "css/**")
include(name: "WEB-INF/**")
}
}
// This closure is passed the location of the staging directory that
// is zipped up to make the WAR file, and the command line arguments.
// Here we override the standard web.xml with our own.
grails.war.resources = { stagingDir, args ->
copy(file: "grails-app/conf/custom-web.xml",
tofile: "${stagingDir}/WEB-INF/web.xml")
}
In your case you may consider a custom grails.war.resources command such as this:
grails.war.resources = { stagingDir, args ->
copy(file: "src/bin/**",
tofile: "${stagingDir}/bin")
}
All of that of course depends on the path you intend to package the additional resources in.
Update In later versions of AntBuilder
to include multiple files the preferred method is to use a fileset
instead of the **
notation:
grails.war.resources = { stagingDir, args ->
copy(todir: "${stagingDir}/bin") {
fileset(dir: "src/bin")
}
}