grailsgrails-3.0grails-3.1

Not able to access web-app folder files in Grails 3


I am not able to access web-app folder files in Grails 3. I have robots.txt in the web-app folder and in Grails 2 I was able to access it directly at http://localhost:8080/robots.txt. After migrating to Grails 3 I am not able to access it anymore at http://localhost:8080/robots.txt.

How can I make these files accessible again?


Solution

  • See https://github.com/grails/grails-core/releases/tag/v3.0.12 and part Location of static resources

    In Grails 3 you can store your files under src/main/resources. You can access them by filename preceded with static for example http://localhost:8080/static/robots.txt.

    This path can be changed using config option as defined in attached URL