------ Using Component Descriptors ------ Edwin Punzalan ------ 24-July-2006 ------ ~~ Licensed to the Apache Software Foundation (ASF) under one ~~ or more contributor license agreements. See the NOTICE file ~~ distributed with this work for additional information ~~ regarding copyright ownership. The ASF licenses this file ~~ to you under the Apache License, Version 2.0 (the ~~ "License"); you may not use this file except in compliance ~~ with the License. You may obtain a copy of the License at ~~ ~~ http://www.apache.org/licenses/LICENSE-2.0 ~~ ~~ Unless required by applicable law or agreed to in writing, ~~ software distributed under the License is distributed on an ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~~ KIND, either express or implied. See the License for the ~~ specific language governing permissions and limitations ~~ under the License. ~~ NOTE: For help with the syntax of this file, see: ~~ http://maven.apache.org/doxia/references/apt-format.html Using Component Descriptors * Introduction Suppose you have a project which will be distributed in two forms: one for use with appserver A and another for appserver B. And as customization for these two servers, you need to exclude some dependencies which are not used by the appserver you will be distributing. <> inside \ may provide the result we want, it is not recommended because if a new appserver becomes available, you will have to maintain the excludes of the other distributions to exclude dependencies meant for the new appserver.> This example demonstrate the use of \, more information can be found {{{../../assembly.html}here}}. * The Assembly Descriptors First, let's write the assembly descriptor for appserver A distribution. It should like this: +----- appserverA zip /lib application:logging application:core application:utils application:appserverA +----- The assembly descriptor for appserver B distribution would then be similar: +----- appserverB zip /lib application:logging application:core application:utils application:appserverB +----- From the two descriptors shown, we can say that there are three artifacts common for both, thus we separate them into a common component descriptor and save it as <<>>. Its contents would be: +----- /lib application:logging application:core application:utils +----- Then the final assembly descriptor for the appserver A would be: +----- appserverA zip src/assemble/component.xml /lib application:appserverA +----- And the corresponding assembly descriptor for the appserver B then would be: +----- appserverB zip src/assemble/component.xml /lib application:appserverB +----- * The POM Now we should update the POM configuration of the project for the Assembly Plugin, which should look like: +----- [...] [...] [...] maven-assembly-plugin ${project.version} src/assemble/appserverA-assembly.xml src/assemble/appserverB-assembly.xml [...] +----- * Creating The Distributions Since we didn't configure the assembly plugin to always generate the configured assemblies during the project's normal build lifecycle, we create the distributions by: +----- mvn assembly:single +-----