Share resources – avoid duplicates
In many multi-module Maven projects, we have noticed that there are certain resources that need to be shared across different modules. These can be images, database scripts, JavaScript files, style sheets, or any other resources. Developers follow different approaches in sharing resources. Some of them are listed here:
- Duplicate resources in every module.
- Use constructs from the underneath source code repository to copy resources, just like
svn externals
. Here you only maintain resources in a single place, but all the modules need them, will get a copy when doing ansvn up
. - Use the Maven remote resource plugin.
Of all the three, the use of the remote resource plugin is the best, as there is no resource duplication. With the remote resource plugin, first you need to create a Maven module, which includes all the resources that need to be shared. The following POM file defines the Maven module for all the shared resources:
<project> <groupId...