简体   繁体   中英

Include folder into grails app

I have a folder with content that i need to access from an application in grails. I put it in the root directory of the application, and development works well, but if I create a .WAR, the folder is not included. I try this:

grails.war.resources = { stagingDir, args ->
    copy( todir: "${stagingDir}/folder" ){
        fileset(dir: "folder")
    }
}

That include the folder, but i can't access it in the same way that i do in development.

How I can do something like this? What is the correct way? Thanks in advance.

This work for me: Copy the folder for web-app and then accessed as follows:

grailsApplication.parentContext.getResource("/").file.toString()

So I access the web-app root in production and development

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM