| ----- |
| Cookbook - How To Generate Assembly |
| ----- |
| Vincent Siveton |
| ----- |
| January 2008 |
| ----- |
| |
| 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.2-beta-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=http://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=http://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=http://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: {{{http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly}http://svn.apache.org/repos/asf/maven/sandbox/trunk/site/cookbook/generate-assembly}} |
| |
| * {{{../../plugins/maven-assembly-plugin/}Maven Assembly Plugin }} |
| |
| [] |