Reputation: 357
I want to convert Java project to Maven. Project has two packages where one package is responsible for program logic and other is responsible for GUI. Both of them have their own resource files.
So the question is about a good and reasonable practice to put these resources in maven project:
Specify common resource folder for both packages (e.g. 'src/main/resources');
Specify separate resource folder for each package. If this way is preferable, what paths names should be:
'src/main/resources/res_for_pack1', 'src/main/resources/res_for_pack2';
'src/main/res_for_pack1', 'src/main/res_for_pack2';
other?
Maven provides possibility to specify several resource folders, but doesn't explain reasons to do this for.
In my case resource file names do not conflict with each other.
Upvotes: 1
Views: 587
Reputation: 26
For large scale or enterprise projects it makes sense to separate program logic (or services) and GUI in different maven modules as they tend to grow. With this approach components within one module may be highly coupled and between modules coupling is low. Resource folders will be within each module, here's the maven structure:
your-project-service
- src
-- main
--- java // program logic sources
--- resources // program logic resources
your-project-web
- src
-- main
--- java // GUI sources
--- resources // GUI resources
If your project is not big enough you can choose simpler way with one module and different packages for domain logic and GUI sources and resources:
your-project
- src
-- main
--- java
---- com.project.service // package for logic sources
---- com.project.web // package for GUI sources
--- resources
---- com.project.service // package for logic resources
---- com.project.web // package for GUI resources
Upvotes: 1
Reputation: 426
The normally used pattern goes such as:
src/main/java/{com,org,..}/project_name/package name
just move your source files to the new directory of a newly created maven project, there are lots of dependencies and other files you won't need to bother with manually.
Upvotes: 0