You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Niels Basjes <Ni...@basjes.nl> on 2023/02/05 15:59:13 UTC

Clean mojo for maven-shade-plugin.

Hi,

I created an issue and put together a pull request that adds a 'clean' mojo
to the maven-shade-plugin.
The purpose is to remove the dependency-reduced-pom.xml (and variants) that
are in general generated but never removed.

By adding support for the clean phase it is now easier to keep a project
clean.

https://issues.apache.org/jira/browse/MSHADE-437
https://github.com/apache/maven-shade-plugin/pull/174

I would like to hear your feedback on this idea/proposal.

-- 
Best regards / Met vriendelijke groeten,

Niels Basjes

Re: Clean mojo for maven-shade-plugin.

Posted by Christoph Läubrich <ma...@laeubi-soft.de>.
The problem with these kind of things is that if you want to replace the 
pom, and don't use the base dir of the project, setting a new pom-file 
(project.setFile), this also magically changes the base-dir of the 
project, and then other plugins are confused and fail and also parent 
references are now wrong (as ../pom.xml point to somewhere else), the 
same problem exits for maven-flatten and tycho-consumer-pom mojo.

The only thing that came into my mind would be to have a new method in 
MavenProject to have a setConsumerFile(...) or something that leaves 
basedir+file alone but can be read then by e.g. Maven Archiver 
/maven-deploy plugins.

I just don't know if it is possible to change MavenProject in such a way ...


Am 05.02.23 um 17:59 schrieb Michael Osipov:
> Am 2023-02-05 um 16:59 schrieb Niels Basjes:
>> Hi,
>>
>> I created an issue and put together a pull request that adds a 'clean' 
>> mojo
>> to the maven-shade-plugin.
>> The purpose is to remove the dependency-reduced-pom.xml (and variants) 
>> that
>> are in general generated but never removed.
>>
>> By adding support for the clean phase it is now easier to keep a project
>> clean.
>>
>> https://issues.apache.org/jira/browse/MSHADE-437
>> https://github.com/apache/maven-shade-plugin/pull/174
>>
>> I would like to hear your feedback on this idea/proposal.
> 
> I consider this wrong because a plugin should follow the Unix principle: 
> do one thing and do it good. For cleaning we have maven-clean-plugin and 
> I have configured a non-default execution for that [1].
> 
> The actual problem is related to 
> https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe 
> that this file must go into the build directory, nowhere else. But this 
> can only change in a major version.
> 
> Michael
> 
> [1] 
> https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140
> 
> 
> ---------------------------------------------------------------------
> 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: Clean mojo for maven-shade-plugin.

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Le dim. 5 févr. 2023 à 20:33, Karl Heinz Marbaise <kh...@gmx.de> a
écrit :

> Hi,
>
> On 05.02.23 19:15, Romain Manni-Bucau wrote:
> > This is typically a hard case cause you can need all sort of values.
> > I often set reduced pom to be generated in target (can be done in a
> parent
> > pom) but some times you want it to be there in place for other
> > stuff/consumers (shkrinwrap, aether, ....).
> > Reversing the default can be good but from the original issue there is no
> > need of anything since it is already handled properly by the plugin if
> > configured so tempted to work more on doc and maybe an extension to
> > autoconfig it than anything else as of today.
> >
>
> The configuration can easily being changed by using the configuration of
> the plugin itself ... (commented on the JIRA issue)...
>

It is more about replacing parent poms for such things by an autoconfig
extension to switch all defaults not fitting your cases (composition vs
inheritance which does not scale).
This issue falls in that category, so yes it is about using the plugin conf
but not inline by convenience...


> Kind regards
> Karl Heinz Marbaise
> > Le dim. 5 févr. 2023 à 19:07, Karl Heinz Marbaise <kh...@gmx.de> a
> > écrit :
> >
> >> Hi,
> >>
> >> On 05.02.23 17:59, Michael Osipov wrote:
> >>> Am 2023-02-05 um 16:59 schrieb Niels Basjes:
> >>>> Hi,
> >>>>
> >>>> I created an issue and put together a pull request that adds a 'clean'
> >>>> mojo
> >>>> to the maven-shade-plugin.
> >>>> The purpose is to remove the dependency-reduced-pom.xml (and variants)
> >>>> that
> >>>> are in general generated but never removed.
> >>>>
> >>>> By adding support for the clean phase it is now easier to keep a
> project
> >>>> clean.
> >>>>
> >>>> https://issues.apache.org/jira/browse/MSHADE-437
> >>>> https://github.com/apache/maven-shade-plugin/pull/174
> >>>>
> >>>> I would like to hear your feedback on this idea/proposal.
> >>>
> >>> I consider this wrong because a plugin should follow the Unix
> principle:
> >>> do one thing and do it good. For cleaning we have maven-clean-plugin
> and
> >>> I have configured a non-default execution for that [1].
> >>>
> >>> The actual problem is related to
> >>> https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe
> >>> that this file must go into the build directory, nowhere else. But this
> >>> can only change in a major version.
> >>
> >> I would say the same thing here because generated files should be put
> >> into target directory nowhere else... but the solution can not be to add
> >> a clean goal to that plugin....
> >>
> >> I would say we might create a Major Release which changes exactly
> >> that..and maybe other things as well...
> >>
> >> Kind regards
> >> Karl Heinz Marbaise
> >>>
> >>> Michael
> >>>
> >>> [1]
> >>>
> >>
> https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140
> >>>
> >>>
> >>> ---------------------------------------------------------------------
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >>
>
>

Re: Clean mojo for maven-shade-plugin.

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 05.02.23 19:15, Romain Manni-Bucau wrote:
> This is typically a hard case cause you can need all sort of values.
> I often set reduced pom to be generated in target (can be done in a parent
> pom) but some times you want it to be there in place for other
> stuff/consumers (shkrinwrap, aether, ....).
> Reversing the default can be good but from the original issue there is no
> need of anything since it is already handled properly by the plugin if
> configured so tempted to work more on doc and maybe an extension to
> autoconfig it than anything else as of today.
>

The configuration can easily being changed by using the configuration of
the plugin itself ... (commented on the JIRA issue)...

Kind regards
Karl Heinz Marbaise
> Le dim. 5 févr. 2023 à 19:07, Karl Heinz Marbaise <kh...@gmx.de> a
> écrit :
>
>> Hi,
>>
>> On 05.02.23 17:59, Michael Osipov wrote:
>>> Am 2023-02-05 um 16:59 schrieb Niels Basjes:
>>>> Hi,
>>>>
>>>> I created an issue and put together a pull request that adds a 'clean'
>>>> mojo
>>>> to the maven-shade-plugin.
>>>> The purpose is to remove the dependency-reduced-pom.xml (and variants)
>>>> that
>>>> are in general generated but never removed.
>>>>
>>>> By adding support for the clean phase it is now easier to keep a project
>>>> clean.
>>>>
>>>> https://issues.apache.org/jira/browse/MSHADE-437
>>>> https://github.com/apache/maven-shade-plugin/pull/174
>>>>
>>>> I would like to hear your feedback on this idea/proposal.
>>>
>>> I consider this wrong because a plugin should follow the Unix principle:
>>> do one thing and do it good. For cleaning we have maven-clean-plugin and
>>> I have configured a non-default execution for that [1].
>>>
>>> The actual problem is related to
>>> https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe
>>> that this file must go into the build directory, nowhere else. But this
>>> can only change in a major version.
>>
>> I would say the same thing here because generated files should be put
>> into target directory nowhere else... but the solution can not be to add
>> a clean goal to that plugin....
>>
>> I would say we might create a Major Release which changes exactly
>> that..and maybe other things as well...
>>
>> Kind regards
>> Karl Heinz Marbaise
>>>
>>> Michael
>>>
>>> [1]
>>>
>> https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140
>>>
>>>
>>> ---------------------------------------------------------------------
>>
>>
>> ---------------------------------------------------------------------
>> 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: Clean mojo for maven-shade-plugin.

Posted by Romain Manni-Bucau <rm...@gmail.com>.
This is typically a hard case cause you can need all sort of values.
I often set reduced pom to be generated in target (can be done in a parent
pom) but some times you want it to be there in place for other
stuff/consumers (shkrinwrap, aether, ....).
Reversing the default can be good but from the original issue there is no
need of anything since it is already handled properly by the plugin if
configured so tempted to work more on doc and maybe an extension to
autoconfig it than anything else as of today.

Le dim. 5 févr. 2023 à 19:07, Karl Heinz Marbaise <kh...@gmx.de> a
écrit :

> Hi,
>
> On 05.02.23 17:59, Michael Osipov wrote:
> > Am 2023-02-05 um 16:59 schrieb Niels Basjes:
> >> Hi,
> >>
> >> I created an issue and put together a pull request that adds a 'clean'
> >> mojo
> >> to the maven-shade-plugin.
> >> The purpose is to remove the dependency-reduced-pom.xml (and variants)
> >> that
> >> are in general generated but never removed.
> >>
> >> By adding support for the clean phase it is now easier to keep a project
> >> clean.
> >>
> >> https://issues.apache.org/jira/browse/MSHADE-437
> >> https://github.com/apache/maven-shade-plugin/pull/174
> >>
> >> I would like to hear your feedback on this idea/proposal.
> >
> > I consider this wrong because a plugin should follow the Unix principle:
> > do one thing and do it good. For cleaning we have maven-clean-plugin and
> > I have configured a non-default execution for that [1].
> >
> > The actual problem is related to
> > https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe
> > that this file must go into the build directory, nowhere else. But this
> > can only change in a major version.
>
> I would say the same thing here because generated files should be put
> into target directory nowhere else... but the solution can not be to add
> a clean goal to that plugin....
>
> I would say we might create a Major Release which changes exactly
> that..and maybe other things as well...
>
> Kind regards
> Karl Heinz Marbaise
> >
> > Michael
> >
> > [1]
> >
> https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140
> >
> >
> > ---------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: Clean mojo for maven-shade-plugin.

Posted by Karl Heinz Marbaise <kh...@gmx.de>.
Hi,

On 05.02.23 17:59, Michael Osipov wrote:
> Am 2023-02-05 um 16:59 schrieb Niels Basjes:
>> Hi,
>>
>> I created an issue and put together a pull request that adds a 'clean'
>> mojo
>> to the maven-shade-plugin.
>> The purpose is to remove the dependency-reduced-pom.xml (and variants)
>> that
>> are in general generated but never removed.
>>
>> By adding support for the clean phase it is now easier to keep a project
>> clean.
>>
>> https://issues.apache.org/jira/browse/MSHADE-437
>> https://github.com/apache/maven-shade-plugin/pull/174
>>
>> I would like to hear your feedback on this idea/proposal.
>
> I consider this wrong because a plugin should follow the Unix principle:
> do one thing and do it good. For cleaning we have maven-clean-plugin and
> I have configured a non-default execution for that [1].
>
> The actual problem is related to
> https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe
> that this file must go into the build directory, nowhere else. But this
> can only change in a major version.

I would say the same thing here because generated files should be put
into target directory nowhere else... but the solution can not be to add
a clean goal to that plugin....

I would say we might create a Major Release which changes exactly
that..and maybe other things as well...

Kind regards
Karl Heinz Marbaise
>
> Michael
>
> [1]
> https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140
>
>
> ---------------------------------------------------------------------


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


Re: Clean mojo for maven-shade-plugin.

Posted by Michael Osipov <mi...@apache.org>.
Am 2023-02-05 um 16:59 schrieb Niels Basjes:
> Hi,
> 
> I created an issue and put together a pull request that adds a 'clean' mojo
> to the maven-shade-plugin.
> The purpose is to remove the dependency-reduced-pom.xml (and variants) that
> are in general generated but never removed.
> 
> By adding support for the clean phase it is now easier to keep a project
> clean.
> 
> https://issues.apache.org/jira/browse/MSHADE-437
> https://github.com/apache/maven-shade-plugin/pull/174
> 
> I would like to hear your feedback on this idea/proposal.

I consider this wrong because a plugin should follow the Unix principle: 
do one thing and do it good. For cleaning we have maven-clean-plugin and 
I have configured a non-default execution for that [1].

The actual problem is related to 
https://issues.apache.org/jira/browse/MSHADE-124 and alike. I believe 
that this file must go into the build directory, nowhere else. But this 
can only change in a major version.

Michael

[1] 
https://github.com/michael-o/tomcatspnegoad/blob/d169b860186b9f009f66409a5df20d0ae887441c/pom.xml#L119-L140


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