Exclude particular class from being shaded using pom.xml

21 views Asked by At
<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.1</version>
                <configuration>
                    <createSourcesJar>true</createSourcesJar>
                    <artifactSet>
        <includes>
            <!-- Include all classes under redis.clients.jedis except RedisUtil -->
            <include>redis.clients.jedis:*</include>
            <exclude>redis.clients.jedis:com/security/cache/RedisUtil.class</exclude>
        </includes>
    </artifactSet>
                    
                    
                    
                    <relocations>
                        <relocation>
                            <pattern>redis.clients.jedis</pattern>
                            <shadedPattern>com.jedis.v390</shadedPattern>
                        </relocation>
                    </relocations>
                    <shadeSourcesContent>true</shadeSourcesContent>                 
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>      
                            </configuration>
                    </execution>
                </executions>
            </plugin>

I want the "com/security/cache/RedisUtil.class" alone to be excluded from shading "redis.clients.jedis" to "com.jedis.v390".

But the above code is not working.

I tried the above code. But the "redis.clients.jedis" in "com/security/cache/RedisUtil.class" was also shaded to "com.jedis.v390".

0

There are 0 answers