During work on different Grails projects, I’d be confronted at times with the mysterious error:
| Building WAR file…..
| Error executing script War: : $USER_HOME/.grails/2.1.1/projects/some-project/resources/grails-app does not exist.
At first I thought to myself “Oh, this is just a glitch; Let’s just manually re-create folder nd get on with it!”, but when the error returned now and then I decided that I really should get to the bottom of this.
As simple as this error is, I found it quite frustrating because some key questions remained unanswered:
- What is this directory needed for?
- If it doesn’t exist, why doesn’t the process create it?
I’d also noticed that the error came up when the $USER_HOME/.grails/2.1.1/projects/some-project directory was cleared, either in the case of a fresh development environment or when clearing the caches and only specific projects suffered from it.
Strangely enough, what looks like the cause of this error is that the Grails project has an empty i18n folder.
Placing a dummy ‘messages.properties’ file or removing the folder altogether will solve it.
This issue’s actually a known bug (see here and here) that hasn’t been fixed yet (as of writing this post).
Given no clear explanation, it seems as if existence of the i18n creates an expectation for a grails-app folder, but the lack of any resources to copy means that this expectation is never fulfilled.