Sharing Assembly Descriptors

So you have created an assembly descriptor that you feel is so good that you want to share it between several of your projects. The simplest way to solve this problem is to create a separate project for your assembly descriptor. Let's call the project my-assembly-descriptor.

The Shared Assembly Descriptor Project

Here's what the directory structure for that project looks like:

    +-- src
    |   `-- main
    |       `-- resources
    |           `-- assemblies
    |               `-- myassembly.xml
    `-- pom.xml

There are just two files in this project: your assembly descriptor myassembly.xml and a pom.xml.

First let's check out the POM for the Shared Assembly Descriptor Project. It is quite simple:

  <name>Shared Assembly Descriptor</name>

Next let's look at our shared assembly descriptor. This is just an example. Replace it with the assembly descriptor you want to share.

<assembly xmlns="" 

Run 'mvn install' on this project to install the Shared Assembly Descriptor project into your local repository.

The Project Using the Shared Assembly Descriptor

In the project that wants to use our Shared Assembly Descriptor, you need to add my-assembly-descriptor as a dependency on the Assembly Plugin. This makes our assembly descriptor available for the Assembly Plugin to use.

              <!-- This is where we use our shared assembly descriptor -->