Sep 22nd, 2010, 01:28 PM
Grails domain classes in STS
I have STS 2.5.0.M3
When I run Grails Tools->Generate Domain Class from the context menu, it puts the class in a folder called domain. The grails generate-xxx scripts seem to require that it be in grails-app in order to be recognized. Is this a bug in STS Grails support, or is there a way to reference domain classes from were STS puts them?
Also, I've had problems getting mockDomain to work.. I suspect this is related.
Sep 22nd, 2010, 04:33 PM
Are you saying that when you run the Generate Domain Class wizard, the resulting domain class is not put in the Project/grails-app/domain folder? This is the default behavior of Grails.
STS should be putting your domain classes in Project/grails-app/domain and the generate-xxx should be looking for your domain classes in that folder.
If this is not the behavior you are seeing, then this is a bug. Please note, though, that in the Grails Project Explorer view, the domain folder is a virtual folder that points to grails-app/domain.
Please let me know where your domain classes are being created.
Sep 22nd, 2010, 05:01 PM
Follow up - steps to recreate / solve
Create new grails app - Fubar using button on the dashbar
Highlight Fubar.. rightclick and select Grails Tools - Create Domain Class named Foo.. it was created in the wrong place.
However.. if I open "Grails perspective" BEFORE doing the above.. it works fine.
Thanks for pointing me in the right direction!