The answer is here:
http://ofps.oreilly.com/titles/9781449323936/chapter_configuration.html
To summarize, you can use configuration like this:
extraSrcDirs = ["$basedir/src/extra1", "$basedir/src/extra2", ...]
eventCompileStart = {
for (String path in extraSrcDirs) {
projectCompiler.srcDirectories << path
}
copyResources buildSettings.resourcesDir
}
eventCreateWarStart = { warName, stagingDir ->
copyResources "$stagingDir/WEB-INF/classes"
}
private copyResources(destination) {
ant.copy(todir: destination,
failonerror: false,
preservelastmodified: true) {
for (String path in extraSrcDirs) {
fileset(dir: path) {
exclude(name: '*.groovy')
exclude(name: '*.java')
}
}
}
}
This will let the grails compiler know about the extra source folders, but I don't think it is enough for STS to know about the source folders. For that, you will have to continue updating the project's .classpath.