I'm using maven assembly plugin version 2.2.1 to build a package in a custom, proprietary format. As a part of this process, I need to extract a bunch of external archives (by external I mean they are not listed as maven dependencies, but they are arbitrary files on the filesystem).
Do you know if maven assembly is able to do that ? I've looked and apparently, it is able to extract a bunch of dependencies in an arbitrary folder, but it is unable to extract an external archive.
Using the <unpack>true</unpack>
in your <dependencySet>
is the way to go.
External archives are not supported by Maven. So you will need to attach them using, e.g. build-helper:attach-artifact
then you can reference it via the <dependencySet>
One of the comments wanted to know how you could avoid installing the attached artifact into the maven repository (local/remote)
The solution to that is to use a dummy module that is a non-transitive dependency.
We are relying on the assembly being built not being used as a transitive dependency.
So you start with a dummy module, which will look a little something like
<project>
...
<packaging>pom</packaging>
...
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
<maven.install.skip>true</maven.install.skip>
<!-- or you could override the plugin configuration for a safer - but less quick - solution -->
</properties>
...
</project>
That dummy module can attach the files using build-helper:attach-artifacts
The your assembly module will just list the dependencies with <scope>provided</scope>
and <optional>true</optional>
as a guard against becoming transitive dependencies. (not necessary if the assembly is say the installer bundle and will not be consumed by other Maven builds.
And there you go, the compressed content will be streamed from one archive to the other and the raw file will not be copied to the remote repo... but you will always need to build the hack module in any reactor that builds the assembly.