Home > Net >  Grails Audit Logging: unable to resolve class grails.plugins.orm.auditable.AuditEventType in applica
Grails Audit Logging: unable to resolve class grails.plugins.orm.auditable.AuditEventType in applica

Time:02-16

grails compile is failing to resolve grails.plugins.orm.auditable.AuditEventType in application.groovy.

I have included the plugin in build.gradle

build.gradle

dependencies {
    // ... other dependencies ...
    compile 'org.grails.plugins:audit-logging:4.0.3'
    // ... other dependencies ...
}

application.groovy

import grails.plugins.orm.auditable.AuditEventType

// ... other config ...

grails.plugin.auditLog.auditDomainClassName = "us.cloudcard.api.AuditLogEvent"
grails.plugin.auditLog.logFullClassName = false
grails.plugin.auditLog.defaultActor = "foo"
grails.plugin.auditLog.verbose = false
grails.plugin.auditLog.verboseEvents = [AuditEventType.UPDATE]

grails compile

user@host dir % grails compile
| Error Error occurred running Grails CLI: startup failed:
script1644337921704582166752.groovy: 1: unable to resolve class grails.plugins.orm.auditable.AuditEventType
 @ line 1, column 1.
   import grails.plugins.orm.auditable.AuditEventType
   ^

1 error

CodePudding user response:

I found a workaround. If you remove the import and instead put the fully qualified class name in the config item, it works fine. I don't really like this because I don't understand why it works when the import doesn't.

application.groovy

// don't import AuditEventType

grails.plugin.auditLog.auditDomainClassName = "us.cloudcard.api.AuditLogEvent"
grails.plugin.auditLog.logFullClassName = false
grails.plugin.auditLog.defaultActor = "foo"
grails.plugin.auditLog.verbose = false
grails.plugin.auditLog.verboseEvents = [grails.plugins.orm.auditable.AuditEventType.UPDATE]

  • Related