You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Be...@bosch-si.com on 2012/06/26 10:24:05 UTC

How to extend the release phases of the DefaultReleaseManager?

Hi,

is there a way to extend the release phases of the DefaultReleaseManager?

I'd like to add a custom release phase to the list of the release managers prepare phases. The implementation of the custom phase should update some project specific files during the release preparation.

Kind regards,
Bernd


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


Re: How to extend the release phases of the DefaultReleaseManager?

Posted by Be...@bosch-si.com.
Thanks for help Stephen.

I implemented a prototype which follows the approach to override the default release manager:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-release-plugin</artifactId>
	<version>2.3.2</version>
	<dependencies>
		<dependency>
			<groupId>org.sourcepit.b2</groupId>
			<artifactId>b2-release-manager</artifactId>
			<version>0.1.0-SNAPSHOT</version>
		</dependency>
	</dependencies>
</plugin>

Actually, I'm just overrideing the default plexus component configuration to add some additional release phases to the release preparation lifecycle. The additional phases are responsible to adjust the OSGi manifest files. Works great!

Another problem was the commit phase. Therefore that the pom.xml file are generated by b2, I don't want to check them into the SCM. The solution was to override/replace the ScmCommitPreparationPhase with another one that commits the modified manifest files instead of the maven pom files.

So in summary the following features would have made my day:
* Customizeable release lifecycle (add/remove release phases)
* Hook to customize/set the set of files that should be commited

Nevertheless, the release plugin is a realy nice pice of code :)

Kind regards,
Bernd


> -----Ursprüngliche Nachricht-----
> Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> Gesendet: Dienstag, 26. Juni 2012 12:00
> An: Maven Developers List
> Betreff: Re: How to extend the release phases of the DefaultReleaseManager?
> 
> of course you could just do
> 
> mvn b2:prep-release release:prepare release:perform
> 
> and have your plugin do the dancing games... but IIRC the pom checks
> take place on the loaded MavenProject and not on the on-disk pom
> 
> On 26 June 2012 10:58, Stephen Connolly <st...@gmail.com> wrote:
> > Ahh, yes... I remember now, I had some theoretical use cases for a
> > transformationGoals (or prePreparationGoals) but no concrete use
> > cases... until now.
> >
> > I think you just about have a valid use case for extending the
> > lifecycle to have an optional set of goals which runs between updating
> > the pom versions and before checking for snapshot dependencies and
> > running the preparationGoals...
> >
> > The reason why I did not implement this is that at the time I did not
> > have a concrete use case, and IIRC, more importantly I think the code
> > does the pom validation BEFORE updating the pom with the new versions.
> > for transformationGoals to be of any real utility, I think it needs to
> > take place before the validation... and after the SCM check... which
> > may involve splitting out the validation code.
> >
> > On 26 June 2012 10:17,  <Be...@bosch-si.com> wrote:
> >> Actually, I'm not sure...
> >>
> >> I have a very special use case, let me try to explain it:
> >>
> >> * We implemented a maven core extension (see ${maven.home}/lib/ext/), called b2.
> >> * b2 is able to generate pom.xml files from plain eclipse plugin projects with all the necessary
> configuration to build it with Maven/Tycho
> >> * Works well for snapshot builds
> >> * For release builds we have to adjust the eclipse plugins versions (specified in the OSGi
> MANIFEST.MF) manually, whitch prevents the usage of the maven release plugin
> >>
> >> So, my idea is to add a prepare phase to the release manager that adjusts these version numbers
> like the RewritePomsForReleasePhase does for poms.
> >>
> >> I'm glad for each proposal :)
> >>
> >>> -----Ursprüngliche Nachricht-----
> >>> Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> >>> Gesendet: Dienstag, 26. Juni 2012 10:48
> >>> An: Maven Developers List
> >>> Betreff: Re: How to extend the release phases of the DefaultReleaseManager?
> >>>
> >>> 95% of use cases that I have seen can be reached by using
> >>> preparationGoals to invoke an additional plugin or mix in an
> >>> additional profile
> >>>
> >>> 99.9% of use cases that I have seen can be reached by using
> >>> preparationGoals and completionGoals to tidy up afterwards.
> >>>
> >>> Of the remaining 0.1% of use cases that I have seen, they should not
> >>> be doing it that way!
> >>>
> >>> Are you sure you need an additional prepare phase?
> >>>
> >>> On 26 June 2012 09:24,  <Be...@bosch-si.com> wrote:
> >>> > Hi,
> >>> >
> >>> > is there a way to extend the release phases of the DefaultReleaseManager?
> >>> >
> >>> > I'd like to add a custom release phase to the list of the release managers prepare phases. The
> >>> implementation of the custom phase should update some project specific files during the release
> >>> preparation.
> >>> >
> >>> > Kind regards,
> >>> > Bernd
> >>> >
> >>> >
> >>> > ---------------------------------------------------------------------
> >>> > 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


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


Re: How to extend the release phases of the DefaultReleaseManager?

Posted by Stephen Connolly <st...@gmail.com>.
of course you could just do

mvn b2:prep-release release:prepare release:perform

and have your plugin do the dancing games... but IIRC the pom checks
take place on the loaded MavenProject and not on the on-disk pom

On 26 June 2012 10:58, Stephen Connolly <st...@gmail.com> wrote:
> Ahh, yes... I remember now, I had some theoretical use cases for a
> transformationGoals (or prePreparationGoals) but no concrete use
> cases... until now.
>
> I think you just about have a valid use case for extending the
> lifecycle to have an optional set of goals which runs between updating
> the pom versions and before checking for snapshot dependencies and
> running the preparationGoals...
>
> The reason why I did not implement this is that at the time I did not
> have a concrete use case, and IIRC, more importantly I think the code
> does the pom validation BEFORE updating the pom with the new versions.
> for transformationGoals to be of any real utility, I think it needs to
> take place before the validation... and after the SCM check... which
> may involve splitting out the validation code.
>
> On 26 June 2012 10:17,  <Be...@bosch-si.com> wrote:
>> Actually, I'm not sure...
>>
>> I have a very special use case, let me try to explain it:
>>
>> * We implemented a maven core extension (see ${maven.home}/lib/ext/), called b2.
>> * b2 is able to generate pom.xml files from plain eclipse plugin projects with all the necessary configuration to build it with Maven/Tycho
>> * Works well for snapshot builds
>> * For release builds we have to adjust the eclipse plugins versions (specified in the OSGi MANIFEST.MF) manually, whitch prevents the usage of the maven release plugin
>>
>> So, my idea is to add a prepare phase to the release manager that adjusts these version numbers like the RewritePomsForReleasePhase does for poms.
>>
>> I'm glad for each proposal :)
>>
>>> -----Ursprüngliche Nachricht-----
>>> Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>>> Gesendet: Dienstag, 26. Juni 2012 10:48
>>> An: Maven Developers List
>>> Betreff: Re: How to extend the release phases of the DefaultReleaseManager?
>>>
>>> 95% of use cases that I have seen can be reached by using
>>> preparationGoals to invoke an additional plugin or mix in an
>>> additional profile
>>>
>>> 99.9% of use cases that I have seen can be reached by using
>>> preparationGoals and completionGoals to tidy up afterwards.
>>>
>>> Of the remaining 0.1% of use cases that I have seen, they should not
>>> be doing it that way!
>>>
>>> Are you sure you need an additional prepare phase?
>>>
>>> On 26 June 2012 09:24,  <Be...@bosch-si.com> wrote:
>>> > Hi,
>>> >
>>> > is there a way to extend the release phases of the DefaultReleaseManager?
>>> >
>>> > I'd like to add a custom release phase to the list of the release managers prepare phases. The
>>> implementation of the custom phase should update some project specific files during the release
>>> preparation.
>>> >
>>> > Kind regards,
>>> > Bernd
>>> >
>>> >
>>> > ---------------------------------------------------------------------
>>> > 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: How to extend the release phases of the DefaultReleaseManager?

Posted by Stephen Connolly <st...@gmail.com>.
Ahh, yes... I remember now, I had some theoretical use cases for a
transformationGoals (or prePreparationGoals) but no concrete use
cases... until now.

I think you just about have a valid use case for extending the
lifecycle to have an optional set of goals which runs between updating
the pom versions and before checking for snapshot dependencies and
running the preparationGoals...

The reason why I did not implement this is that at the time I did not
have a concrete use case, and IIRC, more importantly I think the code
does the pom validation BEFORE updating the pom with the new versions.
for transformationGoals to be of any real utility, I think it needs to
take place before the validation... and after the SCM check... which
may involve splitting out the validation code.

On 26 June 2012 10:17,  <Be...@bosch-si.com> wrote:
> Actually, I'm not sure...
>
> I have a very special use case, let me try to explain it:
>
> * We implemented a maven core extension (see ${maven.home}/lib/ext/), called b2.
> * b2 is able to generate pom.xml files from plain eclipse plugin projects with all the necessary configuration to build it with Maven/Tycho
> * Works well for snapshot builds
> * For release builds we have to adjust the eclipse plugins versions (specified in the OSGi MANIFEST.MF) manually, whitch prevents the usage of the maven release plugin
>
> So, my idea is to add a prepare phase to the release manager that adjusts these version numbers like the RewritePomsForReleasePhase does for poms.
>
> I'm glad for each proposal :)
>
>> -----Ursprüngliche Nachricht-----
>> Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
>> Gesendet: Dienstag, 26. Juni 2012 10:48
>> An: Maven Developers List
>> Betreff: Re: How to extend the release phases of the DefaultReleaseManager?
>>
>> 95% of use cases that I have seen can be reached by using
>> preparationGoals to invoke an additional plugin or mix in an
>> additional profile
>>
>> 99.9% of use cases that I have seen can be reached by using
>> preparationGoals and completionGoals to tidy up afterwards.
>>
>> Of the remaining 0.1% of use cases that I have seen, they should not
>> be doing it that way!
>>
>> Are you sure you need an additional prepare phase?
>>
>> On 26 June 2012 09:24,  <Be...@bosch-si.com> wrote:
>> > Hi,
>> >
>> > is there a way to extend the release phases of the DefaultReleaseManager?
>> >
>> > I'd like to add a custom release phase to the list of the release managers prepare phases. The
>> implementation of the custom phase should update some project specific files during the release
>> preparation.
>> >
>> > Kind regards,
>> > Bernd
>> >
>> >
>> > ---------------------------------------------------------------------
>> > 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


AW: How to extend the release phases of the DefaultReleaseManager?

Posted by Be...@bosch-si.com.
Actually, I'm not sure...

I have a very special use case, let me try to explain it:

* We implemented a maven core extension (see ${maven.home}/lib/ext/), called b2.
* b2 is able to generate pom.xml files from plain eclipse plugin projects with all the necessary configuration to build it with Maven/Tycho
* Works well for snapshot builds
* For release builds we have to adjust the eclipse plugins versions (specified in the OSGi MANIFEST.MF) manually, whitch prevents the usage of the maven release plugin

So, my idea is to add a prepare phase to the release manager that adjusts these version numbers like the RewritePomsForReleasePhase does for poms.

I'm glad for each proposal :)

> -----Ursprüngliche Nachricht-----
> Von: Stephen Connolly [mailto:stephen.alan.connolly@gmail.com]
> Gesendet: Dienstag, 26. Juni 2012 10:48
> An: Maven Developers List
> Betreff: Re: How to extend the release phases of the DefaultReleaseManager?
> 
> 95% of use cases that I have seen can be reached by using
> preparationGoals to invoke an additional plugin or mix in an
> additional profile
> 
> 99.9% of use cases that I have seen can be reached by using
> preparationGoals and completionGoals to tidy up afterwards.
> 
> Of the remaining 0.1% of use cases that I have seen, they should not
> be doing it that way!
> 
> Are you sure you need an additional prepare phase?
> 
> On 26 June 2012 09:24,  <Be...@bosch-si.com> wrote:
> > Hi,
> >
> > is there a way to extend the release phases of the DefaultReleaseManager?
> >
> > I'd like to add a custom release phase to the list of the release managers prepare phases. The
> implementation of the custom phase should update some project specific files during the release
> preparation.
> >
> > Kind regards,
> > Bernd
> >
> >
> > ---------------------------------------------------------------------
> > 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: How to extend the release phases of the DefaultReleaseManager?

Posted by Stephen Connolly <st...@gmail.com>.
95% of use cases that I have seen can be reached by using
preparationGoals to invoke an additional plugin or mix in an
additional profile

99.9% of use cases that I have seen can be reached by using
preparationGoals and completionGoals to tidy up afterwards.

Of the remaining 0.1% of use cases that I have seen, they should not
be doing it that way!

Are you sure you need an additional prepare phase?

On 26 June 2012 09:24,  <Be...@bosch-si.com> wrote:
> Hi,
>
> is there a way to extend the release phases of the DefaultReleaseManager?
>
> I'd like to add a custom release phase to the list of the release managers prepare phases. The implementation of the custom phase should update some project specific files during the release preparation.
>
> Kind regards,
> Bernd
>
>
> ---------------------------------------------------------------------
> 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