Including and Excluding Artifacts

Currently the include/exclude format is based upon the dependency conflict id which has a form of: groupId:artifactId:type:classifier. A shortened form of the dependency conflict id may also be used groupId:artifactId.

The check for inclusion/exclusion is done based on either the dependency conflict id or the shortened form as a String.equals() so it must be an identical match for it to be included or excluded. At present there is no support for regular expressions.

This example excludes the log4j and commons-lang jar files from the assembly. This would be useful when you are building a super distribution assembly which contained sub distributions (i.e. other already assembled zips or tars) where in your pom you are depenedent upon those distributions. But because the distributions transitively depend upon the project's dependencies the assembly also includes the jar files (which are already in the assemblies and don't need to be duplicated)

Your pom might include something like:

    <dependencies>
        <dependency>
            <groupId>YOUR GROUP</groupId>
            <artifactId>YOUR ARTIFACT</artifactId>
            <version>YOUR VERSION</version>
            <classifier>bin</classifier>
            <type>zip</type>
        </dependency>

And then in your assembly you exclude all the jar dependencies pulled in from the binary assembly. In this example the commons-lang and log4j jars are included unnecessarily (as they are in the bin.zip file already)

  <dependencySets>
    <dependencySet>
      ....
      <excludes>
        <exclude>commons-lang:commons-lang</exclude>
        <exclude>log4j:log4j</exclude>
      </excludes>
    </dependencySet>
    ....
  </dependencySets>

What about your Project's Artifacts?

MASSEMBLY-197 added useProjectArtifact and useProjectAttachments to the dependencySet configuration.

See Assembly Descriptor Format for the default values and how to configure them.