Uploaded image for project: 'Maven Shade Plugin'
  1. Maven Shade Plugin
  2. MSHADE-171

"Access Denied" on Windows because shade plugin seems to try to open a directory as Zip-File

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3
    • 2.4.3
    • None
    • Happens on both Windows and Linux

    Description

      Config of plugin is fairly simple, but fails with the error below when I call "mvn package test", it works when I call only "mvn package", it seems the plugin tries to open a directory as zip-file.

      It happens in a multi-module setup when building from the parent-directory. It seems the dependency between the module where the shade plugin runs onto another module causes the target/classes of that module to be added as artifact-file, which causes the shade plugin to fail.

      Let me know if you need a self-contained reproducer project, I can provide one, but it will take some time to build it...

      FYI, there was a similar problem in the war plugin at MWAR-192.

      		<plugin>
      			<groupId>org.apache.maven.plugins</groupId>
      			<artifactId>maven-shade-plugin</artifactId>
      			<version>2.3</version>
      			<executions>
      				<execution>
      					<phase>package</phase>
      					<goals>
      						<goal>shade</goal>
      					</goals>
      				</execution>
      			</executions>
      		</plugin>
      
      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project towerrunner-ui: Error creating shaded jar: C:\workspaces\workspace.GWT.changeset\towerrunner\towerrunner-base\target\classes (Access is denied) -> [Help 1]
      org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:2.3:shade (default) on project towerrunner-ui: Error creating shaded jar: C:\workspaces\workspace.GWT.changeset\towerrunner\towerrunner-base\target\classes (Access is denied)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:216)
              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:108)
              at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
              at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
              at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
              at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
              at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
              at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
              at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
              at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:606)
              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: C:\workspaces\workspace.GWT.changeset\towerrunner\towerrunner-base\target\classes (Access is denied)
              at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:566)
              at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
              at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
              ... 19 more
      Caused by: java.io.FileNotFoundException: C:\workspaces\workspace.GWT.changeset\towerrunner\towerrunner-base\target\classes (Access is denied)
              at java.util.zip.ZipFile.open(Native Method)
              at java.util.zip.ZipFile.<init>(ZipFile.java:215)
              at java.util.zip.ZipFile.<init>(ZipFile.java:145)
              at java.util.jar.JarFile.<init>(JarFile.java:153)
              at java.util.jar.JarFile.<init>(JarFile.java:117)
              at org.apache.maven.plugins.shade.DefaultShader.newJarFile(DefaultShader.java:267)
              at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:100)
              at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:471)
              ... 21 more
      [ERROR] 
      

      Attachments

        1. MSHADE-171.zip
          3 kB
          Dominik Stadler

        Issue Links

          Activity

            People

              krosenvold Kristian Rosenvold
              dominik.stadler@gmx.at Dominik Stadler
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: