You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Baptiste MATHUS <ml...@batmat.net> on 2010/02/06 19:07:55 UTC

Shade or assembly plugin use cases [was:Re: [shade plugin] included 'provided' dependencies]

Hi all,

The answer given below makes me wonder once more what's the best practices,
i.e. which plugin the maven team recommends for each use case.

Here's two assertions about shade and assembly, I'd be delighted that some
of the maven team members correct or confirm those. I feel it could clarify
things for maven users:

   -  When maven-shade-plugin went out, I thought it was designed to be a
   first-choice replacement for the maven-assembly-plugin/jar-with-dependencies
   scenario/use case.
   - Maven-assembly-plugin can do a lot more than just packaging an
   uber-jar, that's why he remains useful.  But when just wanting to package an
   uber-jar, the recommended/maven way is using maven-shade-plugin.


Thanks in advance.
Cheers.

2010/2/6 Ron Wheeler <rw...@artifact-software.com>

> Simone Tripodi wrote:
>
>> Hi all guys,
>> I've been developing a multi-module project where one module is the
>> 'commons' stuff and the other modules are dependent from the first
>> one; when producing artifacts, I want to include the 'commons'
>> dependency in the final jar, so I started using the shade plugin, and
>> declared the 'commons' dependency scope as 'provided', but sadly
>> noticed that dependencies which scope is 'provided' are not included
>> even if specified in the shade configuration.
>> Do you know if there is any other way/best practice that could help me,
>> please?
>> Thanks in advance, best regards!
>> Simo
>>
>> http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
> I am not sure why you need shade but it sounds like jar-with-dependencies
> is for.
> http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
>
> In your library, your dependencies are all declared as compile so that they
> get included into the library jar.
>
> In your client POMs, your shared library is declared as "provided" if you
> want to provide it separately
> or "compile"  if you want it included in your
> client jar that is created with "jar-with-dependencies".
>
>
> I hope that this helps and does match what you are trying to achieve.
>
> Ron
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: Shade or assembly plugin use cases [was:Re: [shade plugin] included 'provided' dependencies]

Posted by Ron Wheeler <rw...@artifact-software.com>.
I should warn everyone here, that I should not be referenced when 
discussing "best practices".
I would best describe our experience as "just practicing".

I can only say that something worked for us after either a bunch of 
testing or a lucky break after a bit of Google searching.

Ron


Baptiste MATHUS wrote:
> Hi all,
>
> The answer given below makes me wonder once more what's the best practices,
> i.e. which plugin the maven team recommends for each use case.
>
> Here's two assertions about shade and assembly, I'd be delighted that some
> of the maven team members correct or confirm those. I feel it could clarify
> things for maven users:
>
>    -  When maven-shade-plugin went out, I thought it was designed to be a
>    first-choice replacement for the maven-assembly-plugin/jar-with-dependencies
>    scenario/use case.
>    - Maven-assembly-plugin can do a lot more than just packaging an
>    uber-jar, that's why he remains useful.  But when just wanting to package an
>    uber-jar, the recommended/maven way is using maven-shade-plugin.
>
>
> Thanks in advance.
> Cheers.
>
> 2010/2/6 Ron Wheeler <rw...@artifact-software.com>
>
>   
>> Simone Tripodi wrote:
>>
>>     
>>> Hi all guys,
>>> I've been developing a multi-module project where one module is the
>>> 'commons' stuff and the other modules are dependent from the first
>>> one; when producing artifacts, I want to include the 'commons'
>>> dependency in the final jar, so I started using the shade plugin, and
>>> declared the 'commons' dependency scope as 'provided', but sadly
>>> noticed that dependencies which scope is 'provided' are not included
>>> even if specified in the shade configuration.
>>> Do you know if there is any other way/best practice that could help me,
>>> please?
>>> Thanks in advance, best regards!
>>> Simo
>>>
>>> http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>>       
>> I am not sure why you need shade but it sounds like jar-with-dependencies
>> is for.
>> http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
>>
>> In your library, your dependencies are all declared as compile so that they
>> get included into the library jar.
>>
>> In your client POMs, your shared library is declared as "provided" if you
>> want to provide it separately
>> or "compile"  if you want it included in your
>> client jar that is created with "jar-with-dependencies".
>>
>>
>> I hope that this helps and does match what you are trying to achieve.
>>
>> Ron
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>     
>
>
>   


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


Re: Shade or assembly plugin use cases [was:Re: [shade plugin] included 'provided' dependencies]

Posted by Simone Tripodi <si...@gmail.com>.
Hi Baptiste,
interesting points, I'd like to know more them too :P
Have a nice weekend,
Simo

http://people.apache.org/~simonetripodi/



On Sat, Feb 6, 2010 at 7:07 PM, Baptiste MATHUS <ml...@batmat.net> wrote:
> Hi all,
>
> The answer given below makes me wonder once more what's the best practices,
> i.e. which plugin the maven team recommends for each use case.
>
> Here's two assertions about shade and assembly, I'd be delighted that some
> of the maven team members correct or confirm those. I feel it could clarify
> things for maven users:
>
>   -  When maven-shade-plugin went out, I thought it was designed to be a
>   first-choice replacement for the maven-assembly-plugin/jar-with-dependencies
>   scenario/use case.
>   - Maven-assembly-plugin can do a lot more than just packaging an
>   uber-jar, that's why he remains useful.  But when just wanting to package an
>   uber-jar, the recommended/maven way is using maven-shade-plugin.
>
>
> Thanks in advance.
> Cheers.
>
> 2010/2/6 Ron Wheeler <rw...@artifact-software.com>
>
>> Simone Tripodi wrote:
>>
>>> Hi all guys,
>>> I've been developing a multi-module project where one module is the
>>> 'commons' stuff and the other modules are dependent from the first
>>> one; when producing artifacts, I want to include the 'commons'
>>> dependency in the final jar, so I started using the shade plugin, and
>>> declared the 'commons' dependency scope as 'provided', but sadly
>>> noticed that dependencies which scope is 'provided' are not included
>>> even if specified in the shade configuration.
>>> Do you know if there is any other way/best practice that could help me,
>>> please?
>>> Thanks in advance, best regards!
>>> Simo
>>>
>>> http://people.apache.org/~simonetripodi/<http://people.apache.org/%7Esimonetripodi/>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
>> I am not sure why you need shade but it sounds like jar-with-dependencies
>> is for.
>> http://maven.apache.org/plugins/maven-assembly-plugin/usage.html
>>
>> In your library, your dependencies are all declared as compile so that they
>> get included into the library jar.
>>
>> In your client POMs, your shared library is declared as "provided" if you
>> want to provide it separately
>> or "compile"  if you want it included in your
>> client jar that is created with "jar-with-dependencies".
>>
>>
>> I hope that this helps and does match what you are trying to achieve.
>>
>> Ron
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Baptiste <Batmat> MATHUS - http://batmat.net
> Sauvez un arbre,
> Mangez un castor !
>

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


Re: Shade or assembly plugin use cases [was:Re: [shade plugin] included 'provided' dependencies]

Posted by Wayne Fay <wa...@gmail.com>.
>   -  When maven-shade-plugin went out, I thought it was designed to be a
>   first-choice replacement for the maven-assembly-plugin/jar-with-dependencies
>   scenario/use case.
>   - Maven-assembly-plugin can do a lot more than just packaging an
>   uber-jar, that's why he remains useful.  But when just wanting to package an
>   uber-jar, the recommended/maven way is using maven-shade-plugin.

That's not my take. Speaking for myself, shade is good when you want
to not only create a jar-with-dependencies but you also want to
"shade" some or all of the 3rd party classes/artifacts (move them
under your own class heirarchy eg com.sun => net.wfay.com.sun).
Assembly is good when you simply want jar-with-deps bundles or need to
construct other random packages types with specific layouts for
installation or deployment into particular environments.

If you don't need/want to shade any of the artifacts, there is no need
to use m-shade-p, and you should be using m-assembly-p (IMO).

I'm not a Maven Developer so feel free to ignore this if/when one of
them comes along and says otherwise...

Wayne

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