Whats the best practice for setting up package structures in a Java Web Application?
How would you setup your src, unit test code, etc?
One another way is to separate out the APIs, services, and entities into different packages.
I usually like to have the following:
These may be considered unconventional, but I find it to be a very nice way to organize things.
I would suggest creating your package structure by feature, and not by the implementation layer. A good write up on this is Java practices: Package by feature, not layer
The way I usually organise is
- src
- main
- java
- groovy
- resources
- test
- java
- groovy
- lib
- build
- test
- reports
- classes
- doc
There are a few existing resources you might check:
For what it's worth, my own personal guidelines that I tend to use are as follows:
A couple of other points:
The way i usually have my hierarchy of folder-