Maven Projects

ASF

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.

Note: This example has been updated for version 2.2. The previous versions of this example were wrong. You must follow the steps below to make your shared assembly descriptors work with version 2.2 or later.

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.

Note: You need to use the file name of your assembly descriptor, without the xml file extension, in <descriptorRef>. You can not use the id of your assembly descriptor. The assembly descriptor used in this example have the file name myassembly.xml, but its id is my-assembly-descriptor-id. Therefor we use myassembly to reference that assembly descriptor.