4

I'm trying to exclude certain classes from being included in a shaded jar.

I have tried several different configurations but for some reason the jars are still being included in my jar. Here is the plugin setup:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.4.2</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>shade</goal>
            </goals>
        </execution>
    </executions>
    <configuration>
        <filters>
            <filter>
                <artifact>*:*</artifact>
                <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                    <exclude>java/*</exclude>
                </excludes>
            </filter>
        </filters>
    </configuration>
</plugin>

I have also tried the following patterns:

<exclude>java.*</exclude>
<exclude>java.util.concurrent.ConcurrentHashMap</exclude>
<exclude>java/util/concurrent/ConcurrentHashMap</exclude>

None of which have actually excluded the file from my jar. How can I exclude this class from my jar?

cscan
  • 3,684
  • 9
  • 45
  • 83

1 Answers1

6

You are only excluding top level files in the java folder. You can exclude recursively like this:

<exclude>java/**/*</exclude>
cscan
  • 3,684
  • 9
  • 45
  • 83