jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • Maven 2.x Shade Plugin
  • MSHADE-65

"Embedded error: error in opening zip file" with non-jar dependency

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.2.1
  • Fix Version/s: 1.3
  • Labels:
    None

Description

I have a project with a dependency on both the jetty jar and the jetty tar.gz (one for compiling, the other due to details of our build system). I would also like to make a shaded jar that includes jetty jar. However, the following exception occurs (to reproduce, do a "mvn -e package" with the attached pom.xml):

[INFO] [shade:shade {execution: default}]
[INFO] Including org.mortbay.jetty:jetty:tar.gz:6.1.18 in the shaded jar.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error creating shaded jar.

Embedded error: error in opening zip file
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Error creating shaded jar.
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:584)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:500)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:479)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:331)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:292)
	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:301)
	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 creating shaded jar.
	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:402)
	at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:453)
	at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:559)
	... 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.jar.JarFile.<init>(JarFile.java:133)
	at java.util.jar.JarFile.<init>(JarFile.java:97)
	at org.apache.maven.plugins.shade.DefaultShader.shade(DefaultShader.java:72)
	at org.apache.maven.plugins.shade.mojo.ShadeMojo.execute(ShadeMojo.java:361)
	... 18 more

If I remove the tar.gz dependency, it shades just fine. Unfortunately, I can't remove that depend without breaking other stuff. Near as I can tell, the shade exclusion mechanism doesn't provide a way to exclude org.mortbay.jetty:jetty:tar.gz without also excluding org.mortbay.jetty:jetty:jar.

Seems like there are at least two possible solutions:

  • ignore non-jar dependencies when shading
  • provide a way to do more granular exclusion
  • Options
    • Sort By Name
    • Sort By Date
    • Ascending
    • Descending
    • Download All

Attachments

  1. XML File
    pom.xml
    26/Oct/09 2:20 PM
    2 kB
    Tim Williamson

Issue Links

is related to

Bug - A problem which impairs or prevents the functions of the product. MSHADE-60 [PATCH] maven shade plugin fails if artifact dependencies contain artifacts that cannot be opened with JarFile class

  • Major - Major loss of function.
  • Closed - The issue is considered finished, the resolution is correct. Issues which are not closed can be reopened.

Activity

  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
Benjamin Bentmann added a comment - 29/Dec/09 5:36 PM

Fixed in r894514 via support for more specific exclusions in the form groupId:artifactId:type:classifier.

Show
Benjamin Bentmann added a comment - 29/Dec/09 5:36 PM Fixed in r894514 via support for more specific exclusions in the form groupId:artifactId:type:classifier.

People

  • Assignee:
    Benjamin Bentmann
    Reporter:
    Tim Williamson
Vote (0)
Watch (0)

Dates

  • Created:
    26/Oct/09 2:20 PM
    Updated:
    29/Dec/09 5:36 PM
    Resolved:
    29/Dec/09 5:36 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.