Uploaded image for project: 'Maven JAR Plugin'
  1. Maven JAR Plugin
  2. MJAR-111

Index creation fails when classpath is set in manifest

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Duplicate
    • 2.2
    • None
    • None
    • None
    • Windows XP, IBM SDK 1.5.0

    Description

      The following plugin configuration fails deterministically, as JarArchiver tries to open a directory folder as a RandomAccessFile, which fails (at least on Windows):

      <plugin>
      <artifactId>maven-jar-plugin</artifactId>
      <configuration>
      <archive>
      <index>true</index>
      <manifest>
      <addClasspath>true</addClasspath>
      </manifest>
      </archive>
      </configuration>
      </plugin>

      The error is:
      $ mvn clean package -e
      [...]
      [INFO] ------------------------------------------------------------------------
      [ERROR] BUILD ERROR
      [INFO] ------------------------------------------------------------------------
      [INFO] Error assembling JAR

      Embedded error: Problem creating jar: d:\adesso\eclipse-Arbeitsbereiche\Portale2-Test1\indextest\target\classes (Zugriff
      verweigert)
      [INFO] ------------------------------------------------------------------------
      [INFO] Trace
      org.apache.maven.lifecycle.LifecycleExecutionException: Error assembling JAR
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:49
      9)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
      a:330)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
      at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
      at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
      at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:618)
      at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
      at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
      at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
      at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
      Caused by: org.apache.maven.plugin.MojoExecutionException: Error assembling JAR
      at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:225)
      at org.apache.maven.plugin.jar.AbstractJarMojo.execute(AbstractJarMojo.java:237)
      at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
      at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
      ... 16 more
      Caused by: org.codehaus.plexus.archiver.ArchiverException: Problem creating jar: d:\adesso\eclipse-Arbeitsbereiche\Porta
      le2-Test1\indextest\target\classes (Zugriff verweigert)
      at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:690)
      at org.apache.maven.archiver.MavenArchiver.createArchive(MavenArchiver.java:421)
      at org.apache.maven.plugin.jar.AbstractJarMojo.createArchive(AbstractJarMojo.java:218)
      ... 19 more
      Caused by: java.io.FileNotFoundException: d:\adesso\eclipse-Arbeitsbereiche\Portale2-Test1\indextest\target\classes (Zug
      riff verweigert)
      at java.io.RandomAccessFile.open(Native Method)
      at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
      at org.codehaus.plexus.archiver.zip.ZipFile.<init>(ZipFile.java:147)
      at org.codehaus.plexus.archiver.zip.ZipFile.<init>(ZipFile.java:132)
      at org.codehaus.plexus.archiver.jar.JarArchiver.grabFilesAndDirs(JarArchiver.java:922)
      at org.codehaus.plexus.archiver.jar.JarArchiver.createIndexList(JarArchiver.java:499)
      at org.codehaus.plexus.archiver.jar.JarArchiver.finalizeZipOutputStream(JarArchiver.java:422)
      at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.execute(AbstractZipArchiver.java:245)
      at org.codehaus.plexus.archiver.AbstractArchiver.createArchive(AbstractArchiver.java:673)
      ... 21 more
      [...]

      See also minimum test project attached.

      Attachments

        1. index-test.tar.gz
          0.8 kB
          tinne

        Issue Links

          Activity

            People

              Unassigned Unassigned
              tinne tinne
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: