maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benson Margulies (JIRA)" <>
Subject [jira] Commented: (MSHADE-104) Cannot shade aspectj library
Date Sun, 20 Nov 2011 22:19:39 GMT


Benson Margulies commented on MSHADE-104:

committed in 1204282. Thanks, Trask.

> Cannot shade aspectj library
> ----------------------------
>                 Key: MSHADE-104
>                 URL:
>             Project: Maven 2.x Shade Plugin
>          Issue Type: Bug
>    Affects Versions: 1.4
>            Reporter: Trask Stalnaker
>            Assignee: Benson Margulies
>             Fix For: 1.6
>         Attachments: MSHADE-104-v3.patch, shaded-aspectjweaver-pom.xml, SimpleRelocator.patch,
SimpleRelocatorTest-2.patch, SimpleRelocatorTest.patch
> performs path matching in canRelocatePath() using String.startsWith()
which treats the relocation path as a non-regex but then performs path substitution in relocatePath()
using String.replaceFirst() which treats the relocation path as a regex.
> The reason I care about this difference is that I'm trying to shade the AspectJ library,
and one of its classes (org.aspectj.weaver.bcel.BcelShadow) uses the string literal
> "(I)Lorg/aspectj/lang/ProceedingJoinPoint;" which understandably doesn't get shaded by
a normal relocation pattern, e.g.
>   <relocation>
>     <pattern>org.aspectj</pattern>
>     <shadedPattern>hidden.aspectj</shadedPattern>
>   </relocation>
> So I would like to hard-code an additional relocation pattern to handle this, e.g.
>   <relocation>
>     <pattern>(I)Lorg/aspectj/lang/ProceedingJoinPoint;</pattern>
>     <shadedPattern>(I)Lhidden/aspectj/lang/ProceedingJoinPoint;</shadedPattern>
>   </relocation>
> This almost works, but not quite because the parentheses get treated as a non-regex string
in canRelocatePath() but then as a regex string in relocatePath().  I can escape the parentheses
to make relocatePath() match, but then of course the escaping makes canRelocatePath() return
false and then it never gets to relocatePath().
> I hope you will consider the attached patch which uses org.codehaus.plexus.util.StringUtils.replaceOnce()
to perform a non-regex substitution instead of String.replaceFirst().  I don't think this
will cause regression issues since the prior match in canRelocatePath() already performs a
non-regex match.  I have attached a simple unit test as well (as a patch to the existing
> In case you're interested, here is a link to the "problem" AspectJ class:
> (see text "(I)Lorg/aspectj/lang/ProceedingJoinPoint;" on line 2924)

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message