blob: 6cb1b2ac302fd285305271acdd0382a0cd1caca7 [file] [log] [blame]
-----
Cookbook - How To Generate Assembly
-----
Vincent Siveton
-----
2008-01-01
-----
~~ 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
Cookbook: How To Generate Assembly?
* Summary
This recipe describes how to generate assembly like zip, tar.gz or tar.bz2.
* Prerequisite Plugins
Here is the list of the plugins used:
*-----------------------------------------------------------+--------------+
|| <<Plugin>> || <<Version>>
*-----------------------------------------------------------+--------------+
| {{{../../plugins/maven-assembly-plugin/} <<<assembly>>>}} | 2.4.1
*-----------------------------------------------------------+--------------+
* Sample Generated Output
+-----+
attach-source-javadoc
|-- pom.xml
|-- src\
`-- target
`-- apache-maven-cookbook-1.0-SNAPSHOT-bin
`-- apache-maven-cookbook-1.0-SNAPSHOT-bin.tar.bz2
`-- apache-maven-cookbook-1.0-SNAPSHOT-bin.tar.gz
`-- apache-maven-cookbook-1.0-SNAPSHOT-bin.zip
+-----+
* Recipe
** Configuring Assembly Descriptor
To generate an assembly, we need to configure an assembly descriptor called <<<bin.xml>>> in the <<<src/assembly>>> directory.
Firstly, we specify the wanted formats, i.e.
%{snippet|id=formats|url=https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly/src/assembly/bin.xml}
And the wanted files sets, i.e.
%{snippet|id=fileSets|url=https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly/src/assembly/bin.xml}
** Configuring Maven Assembly Plugin
We execute the <<<{{{../../plugins/maven-assembly-plugin/single-mojo.html}assembly:single}}>>> goal from the Assembly plugin during the
<<<package>>> phase.
%{snippet|id=assembly|url=https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly/pom.xml}
** Running Maven
Just call Maven to generate the packages:
+-----+
mvn package
+-----+
* Resources
* Source code: {{{https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly}https://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly}}
* {{{../../plugins/maven-assembly-plugin/}Maven Assembly Plugin }}
[]