I am trying to upgrade kotlin version of shading project but i am getting below issue when i upgrade to kotlin 1.5.30:
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.4.1:shade (default) on project authentication-downstream-clients-shaded: Error creating shaded jar: Problem shading JAR /Users/aagrawal/.m2/repository/org/jetbrains/kotlin/kotlin-stdlib/1.5.30/kotlin-stdlib-1.5.30.jar entry kotlin/collections/ArraysKt___ArraysKt.class: org.apache.maven.plugin.MojoExecutionException: Error in ASM processing class kotlin/collections/ArraysKt___ArraysKt.class
Same is not happening in case of kotilin 1.3.31
I have tried several versions of maven-shade-plugin
, tried to exclude this specific class by using
<filters>
<filter>
<artifact>kotlin-stdlib</artifact>
<includes>
<include>kotlin/collections/**</include>
</includes>
</filter>
</filters>
But getting same exception
This worked for me:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>asm:*</exclude> <!-- Exclude current ASM version -->
</excludes>
</filter>
</filters>
<relocations>
<relocation>
<pattern>org.objectweb.asm</pattern> <!-- Relocate to new ASM version -->
<shadedPattern>com.example.asm</shadedPattern>
</relocation>
</relocations>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId> <!-- Add desired ASM version -->
<artifactId>asm</artifactId>
<version>9.4</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>