Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

Guide to creating assemblies

How to use assembly plugin - good

Predefined Descriptors - very useful

Descriptor format - most descriptors have no description

Goals

  • assembly:assembly (default goal) Creates a distribution artifact
  • assembly:directory copies files into a directory structure without packing those file
  • assembly:unpack unpacks packed files

Descriptors

An assembly file consists of three sections

General assembly properties

<id>

the id.

<formats>

list of package formats that should be generated, each in <format> descriptor

<format>

jar, tar.gz, tar.bz2, zip if you know of others, please add them here

<includeBaseDirectory>

defaults to false. Determines if the base directory should be included in the package.

<filesets>

<outputDirectory>

Directory in the target tree where the files should be copied to.

<directory>

copies the contents of this directory to the specified target directory. Copies files by name, does not copy path. if anyone could clarify what other types of patterns can be specified that would be great!

<includes>

copies the specified files that match the pattern (e.g. *.txt) to the target directory. Includes the directory path when copying.

<excludes>

Excludes the specified files that match the pattern (e.g. *.txt) from being copied to the target directory.

<lineEnding>

 

<directoryMode>

 

<fileMode>

 

<dependencySets>

<outputDirectory>

Directory in the target tree where the dependencies should be copied to.

<includes>

Includes the specified dependency

<excludes>

Excludes the specified dependency

<unpack>

Unpacks the contents of the dependencies

<scope>

 

<outputFileNameMapping>

 

<directoryMode>

 

<fileMode>

 

How To

How to copy files into some target directory structure without packaging.

This can be accomplished with the assembly:directory goal. There is only a small downside: The directory
goal always creates a folder below the target directory that is version-specific. This version-specific directory
is even created when <includeBaseDirectory> is set to false (that may be a bug).

How to create your own predefine assembly:

This explains how to create your own predefine assembly and make it available to other projects using a simple refId.

  1. Create a simple jar module
    Your project just need to contain the assambly descriptor file (the directory "assemblies" is required):
            src\main\resources\assembliesmy-distribution.xml
    the name of your assembly ("my-distribution") is the refId that will be use in descriptorRef tag.
    In this project be sure to disable filtering on resources folder otherwise variables like ${artifactId} will be replaced....
  2. Then in a pom parent  (my-pom-parent) you need to declare the assembly configuration:
    "pluginManagement" is used in this example, but you can directly use "plugins" tag in your project.
  3. And Then in your project (that inherite from the "my-pom-parent") you just need to declare the usage of the assembly plugin:
    Of course you can overwrite default plugin configuration.

Tips

Use the Remote Resources Plugin to process LICENSE and NOTICE files for inclusion in your assembly

Assembly Plugin 2.2-beta-1 Issues

From #maven 20070713

<wsmoak> jdcasey:  what version of the assembly plugin do you recommend using ?  I haven't been following it closely.
<jdcasey> I'm partial to the 2.2-b-2-snap, but 2.2-beta-1 is okay, provided you know some things
<jdcasey> what are you trying to do with it?
<wsmoak> make assemblies :)  what things?
<jdcasey> e.g. if you need to unpack dependencies, you'll have to set <outputFileNameMapping></outputFileNameMapping> (blank)
<jdcasey> lol
<jdcasey> that's the big one
<jdcasey> it's fixed in 2.2b2-snap
<jdcasey> fwiw
<jdcasey> wsmoak: and we're still trying to work out the kinks in repo building...that one's troublesome
<jdcasey> I think those are the biggies
  • No labels