It's most likely the case that the save()
call is failing to validate. Replace admin.save()
with
if (!admin.save()) {
println "Failed to save admin due to errors: $admin.errors"
}
or something similar to get an indication of what's going on. Also add another println before this code to ensure that the code is even running - you may have a more significant error in the code.
In general it's best to run grails clean
when code that should work doesn't. It forces a full recompilation and often makes weird behavior go away.