Caught ZipException with 'manifest' goal
----------------------------------------

                 Key: FELIX-352
                 URL: https://issues.apache.org/jira/browse/FELIX-352
             Project: Felix
          Issue Type: Bug
          Components: Maven Bundle Plugin
    Affects Versions: 1.0.0
         Environment: Linux t-quad 2.6.22-gentoo-r5 #1 SMP Thu Aug 23 09:53:07 
CEST 2007 i686 Intel(R) Core(TM)2 Quad CPU @ 2.40GHz GenuineIntel GNU/Linux
Sun JDK 1.6.0.02 [sun-jdk-1.6]
$ mvn -version
Maven version: 2.0.7
Java version: 1.6.0_02
OS name: "linux" version: "2.6.22-gentoo-r5" arch: "i386"
            Reporter: Tobias Roeser


I'm using the maven-bundle-plugin version 1.0 from the 
releases/bundleplugin-1.0.0 branch.

The following command fails on a clean project:
mvn org.apache.felix:maven-bundle-plugin:manifest 

The error message is:
[DEBUG] Configuring mojo 'org.apache.felix:maven-bundle-plugin:1.0.0:manifest' 
-->
[DEBUG]   (f) baseDir = /home/t/work/test
[DEBUG]   (f) buildDirectory = /home/t/work/test/target
[DEBUG]   (f) instructions = {Bundle-Activator=de.example.main.Activator, 
Export-Package=de.example.main.*}
[DEBUG]   (f) manifestLocation = /home/t/work/test/target/classes/META-INF
[DEBUG]   (f) outputDirectory = /home/t/work/test/target/classes
[DEBUG]   (f) project = [EMAIL PROTECTED]
[DEBUG] -- end configuration --
[INFO] [bundle:manifest]
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error trying to generate Manifest

Embedded error: error in opening zip file
[INFO] ------------------------------------------------------------------------
[DEBUG] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error trying to 
generate Manifest
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:564)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:493)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:463)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:311)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:278)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:143)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:334)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:125)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:280)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        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 trying to 
generate Manifest
        at 
org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:63)
        at 
org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:123)
        at 
org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:118)
        at 
org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:443)
        at 
org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:539)
        ... 16 more
Caused by: java.util.zip.ZipException: error in opening zip file
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(ZipFile.java:114)
        at java.util.zip.ZipFile.<init>(ZipFile.java:131)
        at aQute.lib.osgi.ZipResource.build(ZipResource.java:39)
        at aQute.lib.osgi.ZipResource.build(ZipResource.java:32)
        at aQute.lib.osgi.Jar.<init>(Jar.java:31)
        at aQute.lib.osgi.Jar.<init>(Jar.java:50)
        at aQute.lib.osgi.Analyzer.setJar(Analyzer.java:619)
        at 
org.apache.felix.bundleplugin.ManifestPlugin.getAnalyzer(ManifestPlugin.java:116)
        at 
org.apache.felix.bundleplugin.ManifestPlugin.getManifest(ManifestPlugin.java:87)
        at 
org.apache.felix.bundleplugin.ManifestPlugin.execute(ManifestPlugin.java:59)
        ... 20 more

After running 'mvn package' the same call of the goal will succeed. 

Quick workarround: log a better error message reporting which zip/jar file was 
tried to read, when the exception occured.

This problem occurs in a more advanced setup, too. E.g. when configuring the 
maven-bundle-plugin inside the pom.xml like the following:
<plugin>
  <groupId>org.apache.felix</groupId>
  <artifactId>maven-bundle-plugin</artifactId>
  <configuration>
    <instructions>
      <Export-Package>de.example.main.*</Export-Package>
      <Bundle-Activator>de.example.main.Activator</Bundle-Activator>
    </instructions>
  </configuration>
  <executions>
    <execution>
      <id>export-Manifest-for-Eclipse-PDE</id>
      <phase>generate-resources</phase>
      <goals>
        <goal>manifest</goal>
      </goals>
      <configuration>
        <manifestLocation>${basedir}/META-INF</manifestLocation>
       </configuration>
    </execution>
  </executions>
</plugin>

This construct will always fail in the project.

Sidenote: The above configuration works in another project, so maybe it is an 
issue in the dependencies declared in the pom.xml. The error message dosn't 
help in any way to prevent this problem. I can not find out, which Jar/Zip-File 
is corrupt or missing when the error occurs.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to