I’m currently using Grails 2.5.6 and trying to bui...
# questions
u
I’m currently using Grails 2.5.6 and trying to build a WAR file (
grails dev war
) without any front-end files that I don’t need. • First, I tried excluding them in
Config.groovy
using:
Copy code
grails.assets.excludes = [
    "**/*.gsp",
    "**/*.js",
    "**/*.css",
    "**/*.ts",
    "**/*.png",
    "**/*.jpg",
    "**/*.jpeg",
    "**/*.gif",
    "**/*.svg",
]
However, the
.gsp
files were still included in the WAR. • Next, I tried excluding them in BuildConfig.groovy:
Copy code
grails.project.war.excludes = [
    '**/*.gsp',
    'WEB-INF/grails-app/views/**/*'
]

grails.war.resources = { stagingDir ->
    delete(includeEmptyDirs: true) {
        fileset(dir: "${stagingDir}/WEB-INF/grails-app/views") {
            include(name: '**/*.gsp')
        }
    }

    def pluginsDir = new File("${stagingDir}/WEB-INF/plugins")
    if (pluginsDir.exists()) {
        delete(includeEmptyDirs: true) {
            fileset(dir: pluginsDir.absolutePath) {
                include(name: '**/*.gsp')
            }
        }
    }

    delete(includeEmptyDirs: true) {
        fileset(dir: "${stagingDir}/WEB-INF/classes") {
            include(name: '**/*_gsp.class')
        }
    }
}
But the .gsp files are still being packaged. Question: How can I reliably remove all
.gsp
files from the WAR file in Grails 2.5.6?