------ Guide to Creating Assemblies ------ Jason van Zyl ------ 2005-10-12 ------ ~~ 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 Guide to creating assemblies The assembly mechanism in Maven provides an easy way to create distributions using a assembly descriptor and dependency information found in you POM. In order to use the assembly plug-in you need to configure the assembly plug-in in your POM and it might look like the following: +----+ maven org.apache.maven 2.0-beta-3-SNAPSHOT 4.0.0 org.apache.maven maven-embedder Maven Embedder 2.0-beta-3-SNAPSHOT maven-assembly-plugin 2.4 src/assembly/dep.xml ... +----+ You'll notice that the assembly descriptor is located in <<<$\{project.basedir\}/src/assembly>>> which is the {{{../introduction/introduction-to-the-standard-directory-layout.html}standard}} location for assembly descriptors. * Creating a binary assembly This is the most typical usage of the assembly plugin where you are creating a distribution for standard use. +----+ bin tar.gz tar.bz2 zip ${project.basedir} / README* LICENSE* NOTICE* ${project.build.directory} / *.jar ${project.build.directory}/site docs +----+ You can use a manually defined assembly descriptor as mentioned before but it is simpler to use the {{{http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#bin}pre-defined assembly descriptor bin}} in such cases. How to use such pre-defined assembly descriptors is described in the {{{http://maven.apache.org/plugins/maven-assembly-plugin/usage.html#Configuration}documentation of maven-assembly-plugin}}. +----+ dep jar false / / true runtime junit:junit commons-lang:commons-lang commons-logging:commons-logging commons-cli:commons-cli jsch:jsch org.apache.maven.wagon:wagon-ssh plexus:plexus-container-default +----+ If you like to create a source distribution package the best solution is to use the {{{http://maven.apache.org/plugins/maven-assembly-plugin/descriptor-refs.html#src}pre-defined assembly descriptor src}} for such purposes. +----+ src tar.gz tar.bz2 zip ${project.basedir} README* LICENSE* NOTICE* pom.xml true ${project.build.sourceDirectory}/src true +----+ You can now create the defined distribution packages via command line like this: +----+ mvn assembly:single +----+ But the best solution is to create such distribution package within the life-cycle.