While working through a large multi-module project I discovered a custom Assembly Descriptor file. What I don't fully understand is the following, especially the includes
section.
<assembly [...]>
[...]
<dependencySets>
<dependencySet>
<scope>provided</scope>
<unpack>true</unpack>
<unpackOptions>
<includes>
<include>defaults*.properties</include>
</includes>
</unpackOptions>
<outputFileNameMapping>
${artifact.artifactId}
</outputFileNameMapping>
<includes>
<include>${project.groupId}:[project]-settings</include>
</includes>
</dependencySet>
</dependencySets>
[...]
</assembly>
The assembly documentation describes the include
section as a "file and/or directory pattern for matching items to be included from an archive as it is unpacked".
The includes
property documentation of dependencySet
states the following:
If none is present, then represents all valid values.
Does include
work exclusively? Can I therefore expect only the defaults*.properties
to be regarded as provided
(according to this particular section)?
How do unpackOptions-includes
interfer with the basic includes
(last section of dependencySet
)?
How do
unpackOptions-includes
interfer with the basicincludes
(last section ofdependencySet
)?
They control two very different things and do not interfere together:
unpackOptions
control which files inside the artifact are to be unpacked. In your example, it means that, in every dependency that has the scope provided
, only the files matching the pattern defaults*.properties
will be unpacked and therefore kept.dependencySet
control which artifacts are to be included in this set. In your example, only the artifacts matching ${project.groupId}:[project]-settings
will be included in this set.Finally, the assembly descriptor you have will consider every provided
dependency, whose name match ${project.groupId}:[project]-settings
. In each of those artifacts, it will unpack all the files matching the pattern defaults*.properties
.
Does
include
work exclusively?
Yes. By default, everything is included. If you override that configuration, what will be included is what you configured in this tag. Similarly, by default, nothing is excluded (and if you override that configuration, note that the exclusions rules apply on what whas previously included).