Question

I am using maven-assembly-plugin to make a single jar from maven modules. Here is the assembly.xml:

<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>all-jar</id>
<formats>
    <format>jar</format>
</formats>

<includeBaseDirectory>false</includeBaseDirectory>

<dependencySets>
    <dependencySet>
        <unpack>true</unpack>
        <useTransitiveDependencies>false</useTransitiveDependencies>
        <unpackOptions>
            <excludes>
                <exclude>**/resources</exclude>
                <exclude>xsom:xsom</exclude>
            </excludes>
        </unpackOptions>
    </dependencySet>
</dependencySets>

I am using a 3rd part jar in one of my modules. Although i put in the exclude list, this third party jar is also unpacked and isnt excluded. How can i exclude it from unpacking? In fact i only want the resource folders of the modules to be unpacked , other java sources could be stay packed.

Was it helpful?

Solution

You need to put the exclude tag outside of unpack options:

<dependencySets>
    <dependencySet>
        <unpack>true</unpack>
        <useTransitiveDependencies>false</useTransitiveDependencies>
        <excludes>
            <exclude>xsom:xsom</exclude>
        </excludes>
        <unpackOptions>
            <excludes>
                <exclude>**/resources</exclude>
            </excludes>
        </unpackOptions>
    </dependencySet>
</dependencySets>

If you use exclude inside unpackOptions, you exclude contents from being unpacked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top