Book Image

Mastering Apache Maven 3

Book Image

Mastering Apache Maven 3

Overview of this book

Table of Contents (16 chapters)
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 an svn 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>com.packt...