Maven JAR Plugin
  1. Maven JAR Plugin
  2. MJAR-111

Index creation fails when classpath is set in manifest

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Duplicate
    • Affects Version/s: 2.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      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.

      1. index-test.tar.gz
        0.8 kB
        Karsten Tinnefeld

        Issue Links

          Activity

          Karsten Tinnefeld created issue -
          Hide
          Andrea Aime added a comment -

          The same problems occurs using Maven 2.1.0, with the same configuration, in some of the GeoTools modules, using JDK 1.5.0_18 on Ubuntu 9.04. Strange enough, it seems to be happening only on those modules that do not have no dependencies that should be registered in the manifest (e.g., no dependencies at all, or provided dependencies). The moment I add a single external dependency that will result in the classpath entry to be written in the manifest file the bug disappears.

          Show
          Andrea Aime added a comment - The same problems occurs using Maven 2.1.0, with the same configuration, in some of the GeoTools modules, using JDK 1.5.0_18 on Ubuntu 9.04. Strange enough, it seems to be happening only on those modules that do not have no dependencies that should be registered in the manifest (e.g., no dependencies at all, or provided dependencies). The moment I add a single external dependency that will result in the classpath entry to be written in the manifest file the bug disappears.
          Dennis Lundberg made changes -
          Field Original Value New Value
          Link This issue is duplicated by MJAR-69 [ MJAR-69 ]
          Dennis Lundberg made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Duplicate [ 3 ]
          Mark Thomas made changes -
          Project Import Sun Apr 05 10:31:03 UTC 2015 [ 1428229863560 ]
          Mark Thomas made changes -
          Workflow jira [ 12721997 ] Default workflow, editable Closed status [ 12759602 ]
          Mark Thomas made changes -
          Project Import Mon Apr 06 00:05:23 UTC 2015 [ 1428278723217 ]
          Mark Thomas made changes -
          Workflow jira [ 12959453 ] Default workflow, editable Closed status [ 12996363 ]
          Transition Time In Source Status Execution Times Last Executer Last Execution Date
          Open Open Closed Closed
          405d 9h 45m 1 Dennis Lundberg 28/Oct/09 13:18

            People

            • Assignee:
              Unassigned
              Reporter:
              Karsten Tinnefeld
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development