You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by David Blevins <da...@visi.com> on 2008/01/16 02:28:37 UTC

Shade improvement: filtering

I need the ability to include/exclude classes from certain artifacts  
when creating the shaded jar.  In OpenEJB we have a situation where  
one of the jars we are adding to the shaded jar contains a class also  
part of another jar added to the shade.  The class in question truly  
belongs to one of the jars and as only added to the other jar for  
convenience.  I need the ability to either include/exclude classes  
from jars, or a flat to tolerate duplicates.

I've implemented the more robust approach of including/excluding from  
specific artifacts as ideally I'd like to be able to say strictly  
"this jar can only 'export' this package'.  Happy to make any  
suggested tweaks.  http://jira.codehaus.org/browse/MSHADE-12

I can implement a simpler approach which just allows one to ignore  
duplicates if that'd be desired instead.

And as an aside, I have commit privileges but that was through  
involvement in Continuum.  I'd like a nod from someone involved with  
the Shade plugin before committing.

Thanks,
David


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Shade improvement: filtering

Posted by Mauro Talevi <ma...@aquilonia.org>.
David Blevins wrote:
> Mauro, is it possible you can publish a new snapshot or update the perms 
> on the metadata files?

Done both.

Cheers


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Shade improvement: filtering

Posted by David Blevins <da...@visi.com>.
Mauro, is it possible you can publish a new snapshot or update the  
perms on the metadata files?

-David

On Jan 15, 2008, at 9:02 PM, David Blevins wrote:

> On Jan 15, 2008, at 6:47 PM, David Blevins wrote:
>
>> Thanks for reviewing!
>>
>> On Jan 15, 2008, at 6:09 PM, Daniel Kulp wrote:
>>
>>>
>>> David,
>>>
>>> I'm OK with you committing this except for a few minor nits:
>>>
>>> 1) Javadoc for the parameter you added.   The description about the
>>> includes/excludes needs to be added to the javadoc for the  
>>> parameter so
>>> the generated site has that information.
>>
>> Will do.
>
> Done.  Also added some content to the examples.apt.
>
>>
>>> 2) Code formatting isn't quite right for maven.   Maven's style puts
>>> spaces all over the place.   The code you added doesn't match that.
>>
>> Sure, is there a style guide somewhere?  Tried to eye-ball it  
>> obviously.
>
> Found the related intellij config file and fixed the styling.
>
>>> 3) It definitely won't work for the source jar.   You only added the
>>> isFiltered stuff in to the endsWith(.class) part, but not the other
>>> clause of the if.   Most likely, the entire if/else should be  
>>> surrounded
>>> by your check.
>>
>> So likely something like:
>>
>> -if ( !entry.isDirectory() )
>> +if ( !entry.isDirectory() && !isFiltered(jarFilters, name))
>>
>> Which would prevent any addDirectory, addRemappedClass, or  
>> addResource calls.  Could wrap that one if/else but then we'd still  
>> get directories from excluded resources/classes.
>
> Implemented it like this.  Renammed ClassFilter to ArchiveFilter as  
> it now applies to more than just classes.
>
> All checked in and ready to go.  Updated and closed the MSHADE-12 so  
> it should show up in the 1.0-beta-1 release notes.
>
> Thanks!
>
> -David
>
>
>>
>>>
>>> On Tuesday 15 January 2008, David Blevins wrote:
>>>> I need the ability to include/exclude classes from certain  
>>>> artifacts
>>>> when creating the shaded jar.  In OpenEJB we have a situation where
>>>> one of the jars we are adding to the shaded jar contains a class  
>>>> also
>>>> part of another jar added to the shade.  The class in question  
>>>> truly
>>>> belongs to one of the jars and as only added to the other jar for
>>>> convenience.  I need the ability to either include/exclude classes
>>>> from jars, or a flat to tolerate duplicates.
>>>>
>>>> I've implemented the more robust approach of including/excluding  
>>>> from
>>>> specific artifacts as ideally I'd like to be able to say strictly
>>>> "this jar can only 'export' this package'.  Happy to make any
>>>> suggested tweaks.  http://jira.codehaus.org/browse/MSHADE-12
>>>>
>>>> I can implement a simpler approach which just allows one to ignore
>>>> duplicates if that'd be desired instead.
>>>>
>>>> And as an aside, I have commit privileges but that was through
>>>> involvement in Continuum.  I'd like a nod from someone involved  
>>>> with
>>>> the Shade plugin before committing.
>>>>
>>>> Thanks,
>>>> David
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>>
>>> -- 
>>> J. Daniel Kulp
>>> Principal Engineer, IONA
>>> dkulp@apache.org
>>> http://www.dankulp.com/blog
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Shade improvement: filtering

Posted by David Blevins <da...@visi.com>.
On Jan 15, 2008, at 6:47 PM, David Blevins wrote:

> Thanks for reviewing!
>
> On Jan 15, 2008, at 6:09 PM, Daniel Kulp wrote:
>
>>
>> David,
>>
>> I'm OK with you committing this except for a few minor nits:
>>
>> 1) Javadoc for the parameter you added.   The description about the
>> includes/excludes needs to be added to the javadoc for the  
>> parameter so
>> the generated site has that information.
>
> Will do.

Done.  Also added some content to the examples.apt.

>
>> 2) Code formatting isn't quite right for maven.   Maven's style puts
>> spaces all over the place.   The code you added doesn't match that.
>
> Sure, is there a style guide somewhere?  Tried to eye-ball it  
> obviously.

Found the related intellij config file and fixed the styling.

>> 3) It definitely won't work for the source jar.   You only added the
>> isFiltered stuff in to the endsWith(.class) part, but not the other
>> clause of the if.   Most likely, the entire if/else should be  
>> surrounded
>> by your check.
>
> So likely something like:
>
> -if ( !entry.isDirectory() )
> +if ( !entry.isDirectory() && !isFiltered(jarFilters, name))
>
> Which would prevent any addDirectory, addRemappedClass, or  
> addResource calls.  Could wrap that one if/else but then we'd still  
> get directories from excluded resources/classes.

Implemented it like this.  Renammed ClassFilter to ArchiveFilter as it  
now applies to more than just classes.

All checked in and ready to go.  Updated and closed the MSHADE-12 so  
it should show up in the 1.0-beta-1 release notes.

Thanks!

-David


>
>>
>> On Tuesday 15 January 2008, David Blevins wrote:
>>> I need the ability to include/exclude classes from certain artifacts
>>> when creating the shaded jar.  In OpenEJB we have a situation where
>>> one of the jars we are adding to the shaded jar contains a class  
>>> also
>>> part of another jar added to the shade.  The class in question truly
>>> belongs to one of the jars and as only added to the other jar for
>>> convenience.  I need the ability to either include/exclude classes
>>> from jars, or a flat to tolerate duplicates.
>>>
>>> I've implemented the more robust approach of including/excluding  
>>> from
>>> specific artifacts as ideally I'd like to be able to say strictly
>>> "this jar can only 'export' this package'.  Happy to make any
>>> suggested tweaks.  http://jira.codehaus.org/browse/MSHADE-12
>>>
>>> I can implement a simpler approach which just allows one to ignore
>>> duplicates if that'd be desired instead.
>>>
>>> And as an aside, I have commit privileges but that was through
>>> involvement in Continuum.  I'd like a nod from someone involved with
>>> the Shade plugin before committing.
>>>
>>> Thanks,
>>> David
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>>
>> -- 
>> J. Daniel Kulp
>> Principal Engineer, IONA
>> dkulp@apache.org
>> http://www.dankulp.com/blog
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Shade improvement: filtering

Posted by David Blevins <da...@visi.com>.
Thanks for reviewing!

On Jan 15, 2008, at 6:09 PM, Daniel Kulp wrote:

>
> David,
>
> I'm OK with you committing this except for a few minor nits:
>
> 1) Javadoc for the parameter you added.   The description about the
> includes/excludes needs to be added to the javadoc for the parameter  
> so
> the generated site has that information.

Will do.

> 2) Code formatting isn't quite right for maven.   Maven's style puts
> spaces all over the place.   The code you added doesn't match that.

Sure, is there a style guide somewhere?  Tried to eye-ball it obviously.

> 3) It definitely won't work for the source jar.   You only added the
> isFiltered stuff in to the endsWith(.class) part, but not the other
> clause of the if.   Most likely, the entire if/else should be  
> surrounded
> by your check.

So likely something like:

-if ( !entry.isDirectory() )
+if ( !entry.isDirectory() && !isFiltered(jarFilters, name))

Which would prevent any addDirectory, addRemappedClass, or addResource  
calls.  Could wrap that one if/else but then we'd still get  
directories from excluded resources/classes.

-David


>
> On Tuesday 15 January 2008, David Blevins wrote:
>> I need the ability to include/exclude classes from certain artifacts
>> when creating the shaded jar.  In OpenEJB we have a situation where
>> one of the jars we are adding to the shaded jar contains a class also
>> part of another jar added to the shade.  The class in question truly
>> belongs to one of the jars and as only added to the other jar for
>> convenience.  I need the ability to either include/exclude classes
>> from jars, or a flat to tolerate duplicates.
>>
>> I've implemented the more robust approach of including/excluding from
>> specific artifacts as ideally I'd like to be able to say strictly
>> "this jar can only 'export' this package'.  Happy to make any
>> suggested tweaks.  http://jira.codehaus.org/browse/MSHADE-12
>>
>> I can implement a simpler approach which just allows one to ignore
>> duplicates if that'd be desired instead.
>>
>> And as an aside, I have commit privileges but that was through
>> involvement in Continuum.  I'd like a nod from someone involved with
>> the Shade plugin before committing.
>>
>> Thanks,
>> David
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>
>
>
> -- 
> J. Daniel Kulp
> Principal Engineer, IONA
> dkulp@apache.org
> http://www.dankulp.com/blog
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: Shade improvement: filtering

Posted by Daniel Kulp <dk...@apache.org>.
David,

I'm OK with you committing this except for a few minor nits:

1) Javadoc for the parameter you added.   The description about the 
includes/excludes needs to be added to the javadoc for the parameter so 
the generated site has that information.

2) Code formatting isn't quite right for maven.   Maven's style puts 
spaces all over the place.   The code you added doesn't match that.

3) It definitely won't work for the source jar.   You only added the 
isFiltered stuff in to the endsWith(.class) part, but not the other 
clause of the if.   Most likely, the entire if/else should be surrounded 
by your check.

Dan


On Tuesday 15 January 2008, David Blevins wrote:
> I need the ability to include/exclude classes from certain artifacts
> when creating the shaded jar.  In OpenEJB we have a situation where
> one of the jars we are adding to the shaded jar contains a class also
> part of another jar added to the shade.  The class in question truly
> belongs to one of the jars and as only added to the other jar for
> convenience.  I need the ability to either include/exclude classes
> from jars, or a flat to tolerate duplicates.
>
> I've implemented the more robust approach of including/excluding from
> specific artifacts as ideally I'd like to be able to say strictly
> "this jar can only 'export' this package'.  Happy to make any
> suggested tweaks.  http://jira.codehaus.org/browse/MSHADE-12
>
> I can implement a simpler approach which just allows one to ignore
> duplicates if that'd be desired instead.
>
> And as an aside, I have commit privileges but that was through
> involvement in Continuum.  I'd like a nod from someone involved with
> the Shade plugin before committing.
>
> Thanks,
> David
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org



-- 
J. Daniel Kulp
Principal Engineer, IONA
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org