You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Daniel Kulp (JIRA)" <ji...@codehaus.org> on 2008/02/28 15:55:28 UTC

[jira] Commented: (MSHADE-9) failure to shade/relocate plexus-archiver (interfaces not properly relocated)

    [ http://jira.codehaus.org/browse/MSHADE-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_125467 ] 

Daniel Kulp commented on MSHADE-9:
----------------------------------


Question: does this actually cause a problem using the shaded classes?

If you look at the rest of the decompiled class, every reference to UnixStat,ZipLong, ZipShort,  ZipExtraField are fully qualified.  It LOOKS like ASM is leaving some extra class refs in the constant pool, but those classes aren't ever actually referenced in the methods/fields.

To kind of test it, I created a simple test program that created a "new AsiExtraField" and called a few things on it and everything seemed to work without any of the plexus stuff available. (except the shaded jar)

> failure to shade/relocate plexus-archiver (interfaces not properly relocated)
> -----------------------------------------------------------------------------
>
>                 Key: MSHADE-9
>                 URL: http://jira.codehaus.org/browse/MSHADE-9
>             Project: Maven 2.x Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 1.0-alpha-15
>            Reporter: Dan Fabulich
>            Priority: Blocker
>             Fix For: 1.0-beta-2
>
>         Attachments: mshade9-repro.diff
>
>
> I tried using the shade plugin with surefire, to shade/relocate plexus-archiver.  I'm trying to relocate its package to be org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.  It took several tries due to MSHADE-5, but even when it finally "worked", it failed to modify plexus-archiver correctly.
> org.codehaus.plexus.archiver.zip.AsiExtraField implements org.codehaus.plexus.archiver.zip.ZipExtraField.  But when I try to run p-archiver after shading it, I get this exception:
> java.lang.ExceptionInInitializerError
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ZipEntry.getCentralDirectoryExtra(ZipEntry.java:386)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ZipOutputStream.writeCentralFileHeader(ZipOutputStream.java:769)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ZipOutputStream.finish(ZipOutputStream.java:320)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ZipOutputStream.close(ZipOutputStream.java:542)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchiveMain(AbstractZipArchiver.java:378)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.AbstractZipArchiver.createArchive(AbstractZipArchiver.java:250)
>         at org.apache.maven.surefire.booter.ForkConfiguration.createJar(ForkConfiguration.java:264)
> [snip]
> Caused by: java.lang.RuntimeException: class org.codehaus.plexus.archiver.zip.AsiExtraField doesn't implement ZipExtraField
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ExtraFieldUtils.register(ExtraFieldUtils.java:63)
>         at org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ExtraFieldUtils.<clinit>(ExtraFieldUtils.java:43)
>         ... 31 more
> My decompiler (DJ) shows that the interfaces were partially but not entirely shaded correctly:
> package org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip;
> import java.util.zip.CRC32;
> import java.util.zip.ZipException;
> import org.codehaus.plexus.archiver.UnixStat;
> import org.codehaus.plexus.archiver.zip.ZipExtraField;
> import org.codehaus.plexus.archiver.zip.ZipLong;
> import org.codehaus.plexus.archiver.zip.ZipShort;
> // Referenced classes of package org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip:
> //            ZipExtraField, ZipShort, ZipLong
> public class AsiExtraField
>     implements org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.zip.ZipExtraField, org.apache.maven.surefire.shaded.org.codehaus.plexus.archiver.UnixStat, Cloneable
> {
> [...]
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira