tags:

views:

20

answers:

2

What is the best way to organize directories within a large grails application?

In a typical Spring application, we'd have myproject/domain/ and myproject/web/controllers and myproject/services

Since grails puts these artifacts in their own directories... and then just uses the same base project package for everything, what is the best practice? Use the same sub package name for domain objects, controllers, services too?

Ken

A: 

Use packages like any other app. Classes for com.mycompany should go in myproject/grails-app/domain/com/mycompany, myproject/grails-app/services/com/mycompany, myproject/grails-app/controllers/com/mycompany, etc.

Decide on your package structure as makes sense for you. Split on component type or on functionality type (but I recommend functionality type).

I don't see a difference here from the structure you mentioned.

John Stoneham
A: 

There's a great blog post about package naming in Grails applications.

Stefan