maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Karl Heinz Marbaise (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (MSHADE-302) maven-shade-plugin fails to minimize JAR with Java 11
Date Sat, 20 Oct 2018 07:02:00 GMT

    [ https://issues.apache.org/jira/browse/MSHADE-302?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16657769#comment-16657769
] 

Karl Heinz Marbaise commented on MSHADE-302:
--------------------------------------------

I appreciate your patch ...so I could initiate an other release....with the fix...great.

> maven-shade-plugin fails to minimize JAR with Java 11
> -----------------------------------------------------
>
>                 Key: MSHADE-302
>                 URL: https://issues.apache.org/jira/browse/MSHADE-302
>             Project: Maven Shade Plugin
>          Issue Type: Bug
>         Environment: maven-shade-plugin 3.2.1-SNAPSHOT or master branch.
> openjdk version "11" 2018-09-25
> OpenJDK Runtime Environment 18.9 (build 11+28)
> OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
>            Reporter: Clément MATHIEU
>            Priority: Major
>
> While checking whether maven-shade-plugin is Java 11 compatible or not, I noticed that
it fails when minimizeJar is set to true and a class contains a nested static class.
> I was able to reproduce the issue by patching the shading-with-java-11-sources integration
test:
> {code}
> diff --git a/src/it/shading-with-java-11-sources/pom.xml b/src/it/shading-with-java-11-sources/pom.xml
> index 0ea23fe..34898b7 100644
> --- a/src/it/shading-with-java-11-sources/pom.xml
> +++ b/src/it/shading-with-java-11-sources/pom.xml
> @@ -76,2 +76,3 @@ under the License.
>              <configuration>
> +              <minimizeJar>true</minimizeJar>
>                <shadedArtifactAttached>true</shadedArtifactAttached>
> diff --git a/src/it/shading-with-java-11-sources/src/main/java/org/apache/maven/plugins/shade/its/App.java
b/src/it/shading-with-java-11-sources/src/main/java/org/apache/maven/plugins/shade/its/App.java
> index a92156e..c9fc298 100644
> --- a/src/it/shading-with-java-11-sources/src/main/java/org/apache/maven/plugins/shade/its/App.java
> +++ b/src/it/shading-with-java-11-sources/src/main/java/org/apache/maven/plugins/shade/its/App.java
> @@ -49,2 +49,5 @@ public class App
>      }
> +
> +    static class Foo {
> +    }
>  }
> {code}
>  
> Running {{mvn  -Prun-its -Dinvoker.test="*java-11*" verify}} leads to the following exception
> {code}
> Caused by: java.lang.UnsupportedOperationException: This feature requires ASM7
>     at org.objectweb.asm.ClassVisitor.visitNestMember (ClassVisitor.java:236)
>     at org.objectweb.asm.ClassVisitor.visitNestMember (ClassVisitor.java:239)
>     at org.objectweb.asm.commons.ClassRemapper.visitNestMember (ClassRemapper.java:190)
>     at org.objectweb.asm.ClassReader.accept (ClassReader.java:651)
>     at org.objectweb.asm.ClassReader.accept (ClassReader.java:391)
>     at org.vafer.jdependency.Clazzpath.addClazzpathUnit (Clazzpath.java:179)
>     at org.vafer.jdependency.Clazzpath.addClazzpathUnit (Clazzpath.java:140)
>     at org.apache.maven.plugins.shade.filter.MinijarFilter.<init> (MinijarFilter.java:97)
>     at org.apache.maven.plugins.shade.mojo.ShadeMojo.getFilters (ShadeMojo.java:834)
>     at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute (ShadeMojo.java:434)
>     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:208)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:154)
>     at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:146)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
>     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
>     at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build
(SingleThreadedBuilder.java:56)
>     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
>     at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
>     at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
>     at org.apache.maven.cli.MavenCli.execute (MavenCli.java:954)
>     at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
>     at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
>     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
>     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
>     at java.lang.reflect.Method.invoke (Method.java:566)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
>     at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
> {code}
> I have not yet troubleshooted the issue. Other jdendency users seems to be facing a similar
issue, see https://github.com/tcurdt/jdependency/issues/21. I have also seen a similar stack
trace in Spring SPR-17371.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message