I created a Grails plugin and created a domain class in it called Config:
package com.company.common
class Config {
String defaultTimeZone
String defaultLanguage
}
In another Grails project, I’m including the plugin and I have this line in Bootstrap.groovy:
import com.company.common.Config
Every time I try to run the project though, I get this error:
C:\Code\grails-app\conf\BootStrap.groovy: 4: unable to resolve class com.company.common.Config
It works if I have the Config domain class in the same Grails project. It also seems to work if I rename it to something like ProjectConfig in the plugin project.
Does anyone know why I can’t reference a domain class called Config in another project?
P.S. All the other domain classes in the plugin project can be accessed from the main Grails project, only the Config class gives me problems.
Grails plugins have specific files that are removed when packaging the plugin (so you can use them for testing). You can find the list here Grails Plugins #Creating and Installing Plugins. For convenience, here is the list:
While this list does not include Config.groovy files in domain class folders, it might be caught by this. Would be worth checking if the Config.groovy file gets carried over to the packaged plugin, or if you can live with renaming the file, that would work as well.