// Write the context.xml file in META-INF and WEB-INF
def contextDotXml = """\
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Context>
    <Loader delegate=\"true\"/>
</Context>"""
new File("$basedir/web-app/META-INF/context.xml").write contextDotXml
new File("$basedir/web-app/WEB-INF/context.xml").write contextDotXml
// Write the context.xml file in META-INF and WEB-INF
def contextDotXml = """\
<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <Loader delegate="true"/>
</Context>"""

def webAppDir = new File(grailsSettings.baseDir, "web-app")
def webInfDir = new File(webAppDir, "WEB-INF")
def metaInfDir = new File(webAppDir, "META-INF")

if (!webInfDir.exists())) {
    event "StatusUpdate", [ "Your project does not have a 'web-app/WEB-INF' directory. Perhaps it's corrupt?" ]
}

webInfDir.mkdirs()
metaInfDir.mkdirs()
new File(webInfDir, "context.xml").write contextDotXml
new File(metaInfDir, "context.xml").write contextDotXml
Add warning on plugin installation if required dirs do not exist.
Add warning on plugin installation if required dirs do not exist.

In the case where a project doesn't have web-app/WEB-INF or web-app/META-INF directories, the plugin installation causes an error, but without any information as to why it failed. This change adds a warning and then creates the required directories.