Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.4.2
-
None
-
None
-
Linux Ubuntu, Java 1.8.0_66, Maven 3.3.9
Description
MSHADE-171 reported a problem with locked files when running on Windows. The same sample project fails for me with a different error message when I run the steps "package test" on Linux. I tried using the latest 2.4.3-SNAPSHOT version which should have fixes for MSHADE-171.
The error-output is listed below.
Calling "mvn package" or "mvn test" works, it only fails if both goals/phases are executed in one command.
I tried to debug this and found that in the error-case in the code at ShadeMojo.processArtifactSelectors() the call to project.getArtifacts() returns an Artifact which has the file-path to the classes directory, but has Artifact.getType() == "jar".
It seems running the test goal/phase adds this Artifact and the shade-plugin does not handle this correctly as it expects all Artifacts to be jars, not directories.
Let me know if I can provide more information. I am attaching the same sample-project that was used in MSHADE-171 as it can be used to reproduce this problem as well.
[INFO] Reactor Summary: [INFO] [INFO] mshade171 ......................................... SUCCESS [0.003s] [INFO] mshade171-base .................................... SUCCESS [1.596s] [INFO] mshade171-ui ...................................... FAILURE [0.697s] [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.488s [INFO] Finished at: Fri Nov 27 21:24:34 CET 2015 [INFO] Final Memory: 10M/211M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3-SNAPSHOT:shade (default) on project mshade171-ui: Error creating shaded jar: /tmp/shade/mshade171-base/target/classes (Ist ein Verzeichnis) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.4.3-SNAPSHOT:shade (default) on project mshade171-ui: Error creating shaded jar: /tmp/shade/mshade171-base/target/classes (Ist ein Verzeichnis) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) 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) Caused by: org.apache.maven.plugin.MojoExecutionException: Error creating shaded jar: /tmp/shade/mshade171-base/target/classes (Ist ein Verzeichnis) at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:539) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) ... 19 more Caused by: java.io.FileNotFoundException: /tmp/shade/mshade171-base/target/classes (Ist ein Verzeichnis) at java.util.zip.ZipFile.open(Native Method) at java.util.zip.ZipFile.<init>(ZipFile.java:219) at java.util.zip.ZipFile.<init>(ZipFile.java:149) at java.util.jar.JarFile.<init>(JarFile.java:166) at java.util.jar.JarFile.<init>(JarFile.java:130) at org.apache.maven.plugins.shade.DefaultShader.newJarFile(DefaultShader.java:351) at org.apache.maven.plugins.shade.DefaultShader.goThroughAllJarEntriesForManifestTransformer(DefaultShader.java:261) at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:98) at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:454) ... 21 more [ERROR] [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn <goals> -rf :mshade171-ui