Question

I created a simple grails 2.0.1 plugin with a domain "User". Created scaffolding controllers and views. But when I do grails run-app and goto the user/list url, I get the error

No signature of method: packagename.User.list() is applicable for argument types: () values: [] Possible solutions: list(), list(java.util.Map), is(java.lang.Object), wait(), lock(), find()

But when I use the plugin within a grails app (without publishing,packing), it works fine.

Question is - I want to be able to test the grails plugin controller without an app. Im guessing im missing some configufaration.

Was it helpful?

Solution

It looks like you don't have the Hibernate plugin installed. It's added to BuildConfig.groovy by default for applications, but not for plugins. You can install it with grails install-plugin hibernate 2.0.1 and it will add it to application.properties, and this approach keeps it from being a dependency when users install your plugin.

You can also add it to BuildConfig.groovy but be sure to add export = false unless your plugin does actually require Hibernate to function. If it would work with any GORM implementation (e.g. Mongo) then it shouldn't be exported:

plugins {
    build(":tomcat:$grailsVersion",
          ":hibernate:$grailsVersion",
          ":release:1.0.1") {
        export = false
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top