how to use both buildnumber-maven-plugin and maven-release-plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

how to use both buildnumber-maven-plugin and maven-release-plugin

Justin Georgeson-2
The 'clean verify' invoked by release:prepare fails in buildnumber-maven-plugin because pom.xml is modified. I can pass arguments to release:prepare have buildnumber-maven-plugin skip the check for modifications, but that check is one of the main motivations for using it in the first place. What are other people doing here?

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.
Reply | Threaded
Open this post in threaded view
|

Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Pascal
For me it's hard to understand the problem you are having, it might help to
specify the exact errors you are getting.

If you are willing to try something other than the release plugin, have a
look at https://axelfontaine.com/blog/dead-burried.html

Cheers,

Pascal


2017-10-23 18:40 GMT+02:00 Justin Georgeson <
[hidden email]>:

> The 'clean verify' invoked by release:prepare fails in
> buildnumber-maven-plugin because pom.xml is modified. I can pass arguments
> to release:prepare have buildnumber-maven-plugin skip the check for
> modifications, but that check is one of the main motivations for using it
> in the first place. What are other people doing here?
>
> ----------------------------------------------------------------------
> This e-mail, including any attached files, may contain confidential and
> privileged information for the sole use of the intended recipient.  Any
> review, use, distribution, or disclosure by others is strictly prohibited.
> If you are not the intended recipient (or authorized to receive information
> for the intended recipient), please contact the sender by reply e-mail and
> delete all copies of this message.
>
Reply | Threaded
Open this post in threaded view
|

Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Karl Heinz Marbaise-3
In reply to this post by Justin Georgeson-2
Hi,

the question is what the real problem is?

Can you have an example project which shows the problem? Or can you
describe more in detail what exactly does not work or not work like you
expect it..

Kind regards
Karl Heinz Marbaise

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Justin Georgeson-2
I want to enforce in every build (not just release builds) that the working copy is pristine (ie doCheck=true for buildnumber plugin), but release:prepare dirties the working copy before running 'clean verify'. So when I run release:prepare the buildnumber plugin fails. I can work around it by running 'mvn release:prepare -Darguments="-Dmaven.buildNumber.doCheck=false"' but that just seems hacky, so I was curious if there's a better way.

Looks like if I configure a default property value for maven.buildNumber.doCheck to true, then I can have a profile activate when file release.properties exists to set the doCheck property to false, and that gets me through release:prepare. Any pitfalls I might be walking into with something like that?

-----Original Message-----
From: Karl Heinz Marbaise [mailto:[hidden email]]
Sent: Tuesday, October 24, 2017 4:30 AM
To: Maven Users List <[hidden email]>; Justin Georgeson <[hidden email]>
Subject: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and maven-release-plugin

External Sender: Use caution with links/attachments.



Hi,

the question is what the real problem is?

Can you have an example project which shows the problem? Or can you describe more in detail what exactly does not work or not work like you expect it..

Kind regards
Karl Heinz Marbaise

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Karl Heinz Marbaise-3
Hi,

On 24/10/17 15:59, Justin Georgeson wrote:
> I want to enforce in every build (not just release builds)
 > that the working copy is pristine
 >
(ie doCheck=true for buildnumber plugin),

On a CI server or locally ?

> but release:prepare dirties the working copy before running 'clean verify'.

Of course it does cause it changes the pom files to represent the
correct version...and commit this state of the change back to version
control...


> So when I run release:prepare the buildnumber plugin fails. I can work around it by running 'mvn release:prepare
 >  -Darguments="-Dmaven.buildNumber.doCheck=false"' but that just seems
hacky, so I was curious if there's a better way.


You know about the release:prepare goal what it is exactly doing ?

http://maven.apache.org/maven-release/maven-release-plugin/examples/prepare-release.html

Maybe I misunderstand your question but it sounds like you are trying to
resolve a thing which has been solved by maven-release-plugin already?...

Kind regards
Karl Heinz Marbaise

>
> Looks like if I configure a default property value for maven.buildNumber.doCheck to true, then I can have a profile activate when file release.properties exists to set the doCheck property to false, and that gets me through release:prepare. Any pitfalls I might be walking into with something like that?
>
> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:[hidden email]]
> Sent: Tuesday, October 24, 2017 4:30 AM
> To: Maven Users List <[hidden email]>; Justin Georgeson <[hidden email]>
> Subject: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and maven-release-plugin
>
> External Sender: Use caution with links/attachments.
>
>
>
> Hi,
>
> the question is what the real problem is?
>
> Can you have an example project which shows the problem? Or can you describe more in detail what exactly does not work or not work like you expect it..
>
> Kind regards
> Karl Heinz Marbaise
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Justin Georgeson-2


> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:[hidden email]]
> Sent: Tuesday, October 24, 2017 12:25 PM
> To: Justin Georgeson <[hidden email]>;
> [hidden email]; Maven Users List <[hidden email]>
> Subject: Re: [EXTERNAL] Re: how to use both buildnumber-maven-plugin
> and maven-release-plugin
>
> External Sender: Use caution with links/attachments.
>
>
>
> Hi,
>
> On 24/10/17 15:59, Justin Georgeson wrote:
> > I want to enforce in every build (not just release builds)
>  > that the working copy is pristine
>  >
> (ie doCheck=true for buildnumber plugin),
>
> On a CI server or locally ?

It is enabled globally in the parent POM, as during transition from older Ant builds to Maven it has helped remind developers to do things like use resource filtering from source folder to build output folder rather than modifying in place (whether that be for source code or unit test resources) and also reduced pushing incomplete changes forgetting to include some of the modified files. I'm guessing this default setting will be the key distinction why people are confused how I'm having an issue with the combination.

> > but release:prepare dirties the working copy before running 'clean verify'.
>
> Of course it does cause it changes the pom files to represent the correct
> version...and commit this state of the change back to version control...

My impression had been that the release plugin was invoking goals from the tag that it creates, rather than from a dirty working copy, for guaranteed reproducible results. I can see why that would be undesirable for centralized VCS like subversion though.

> > So when I run release:prepare the buildnumber plugin fails. I can work
> > around it by running 'mvn release:prepare
>  >  -Darguments="-Dmaven.buildNumber.doCheck=false"' but that just
> seems hacky, so I was curious if there's a better way.
>
>
> You know about the release:prepare goal what it is exactly doing ?
>
> https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__maven.apache.org_maven-2Drelease_maven-2Drelease-
> 2Dplugin_examples_prepare-
> 2Drelease.html&d=DwICaQ&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_h
> VPx52Ly1s&m=WiG6vQ6aiVWMFCcORnOeArhgldg_TZF7xNV8d1YlECI&s=4f-
> Z8rl_qNhiUE4vBGA0mqAkY7Gb2rBntNqcUT9JwsE&e=

Clearly I didn't know _exactly_ what it was doing :) Most of our internal Maven usage has been for the Eclipse Tycho plugins thus far, and that's just not really compatible with maven-release-plugin so there's some technical debt I'm trying to get rid of to make our parent POMs more friendly to pure maven projects.
 
> Maybe I misunderstand your question but it sounds like you are trying to
> resolve a thing which has been solved by maven-release-plugin already?...

I just wanted opinions on the cleanest way to configure the two to work together. I still need buildnumber-maven-plugin to run during the release build. I now know I have to disable its check when preparing a release.

If I set project.properties.maven.buildNumber.doCheck to true (instead of setting it to doCheck true in the plugin <configuration>), then have a profile that activates on present of maven-release-plugin temporary files and sets the property to false (like in example POM [1], corp proxy blocks pastebin), then the release:prepare and release:perform goals seem work without having to specify any extra -D command-line arguments and with the added benefit that developers should then be able to also set maven.buildNumber.doCheck to false in their settings.xml if they want to. Is there a better activation rule (than what's in the example POM [1)?

[1] https://paste.ee/p/tKYyh

> Kind regards
> Karl Heinz Marbaise
>
> >
> > Looks like if I configure a default property value for
> maven.buildNumber.doCheck to true, then I can have a profile activate
> when file https://urldefense.proofpoint.com/v2/url?u=http-
> 3A__release.properties&d=DwICaQ&c=PskvixtEUDK7wuWU-
> tIg6oKuGYBRbrMXk2FZvF0UfTo&r=IaG729QyGh1osYCbh8OX9axItHyepxef_h
> VPx52Ly1s&m=WiG6vQ6aiVWMFCcORnOeArhgldg_TZF7xNV8d1YlECI&s=DzY
> 1956dm73empQx_us9QzZ5BL5yahhbKcjGLKyMT80&e= exists to set the
> doCheck property to false, and that gets me through release:prepare. Any
> pitfalls I might be walking into with something like that?
> >
> > -----Original Message-----
> > From: Karl Heinz Marbaise [mailto:[hidden email]]
> > Sent: Tuesday, October 24, 2017 4:30 AM
> > To: Maven Users List <[hidden email]>; Justin Georgeson
> > <[hidden email]>
> > Subject: [EXTERNAL] Re: how to use both buildnumber-maven-plugin and
> > maven-release-plugin
> >
> > External Sender: Use caution with links/attachments.
> >
> >
> >
> > Hi,
> >
> > the question is what the real problem is?
> >
> > Can you have an example project which shows the problem? Or can you
> describe more in detail what exactly does not work or not work like you
> expect it..
> >
> > Kind regards
> > Karl Heinz Marbaise
> >

----------------------------------------------------------------------
This e-mail, including any attached files, may contain confidential and privileged information for the sole use of the intended recipient.  Any review, use, distribution, or disclosure by others is strictly prohibited.  If you are not the intended recipient (or authorized to receive information for the intended recipient), please contact the sender by reply e-mail and delete all copies of this message.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Stephen Coy-4
In reply to this post by Pascal
Hi Pascal,

Unfortunately this method results in pom files being deployed with releases that do not have corresponding versions in them.

In fact, the version is literally:

        <version>${revision}</version>

This results in build warnings for consumers of the released artifact.

Cheers,

Steve C

> On 24 Oct 2017, at 8:27 pm, Pascal <[hidden email]> wrote:
>
> For me it's hard to understand the problem you are having, it might help to
> specify the exact errors you are getting.
>
> If you are willing to try something other than the release plugin, have a
> look at https://axelfontaine.com/blog/dead-burried.html
>
> Cheers,
>
> Pascal
>
>
> 2017-10-23 18:40 GMT+02:00 Justin Georgeson <
> [hidden email]>:
>
>> The 'clean verify' invoked by release:prepare fails in
>> buildnumber-maven-plugin because pom.xml is modified. I can pass arguments
>> to release:prepare have buildnumber-maven-plugin skip the check for
>> modifications, but that check is one of the main motivations for using it
>> in the first place. What are other people doing here?
>>
>> ----------------------------------------------------------------------
>> This e-mail, including any attached files, may contain confidential and
>> privileged information for the sole use of the intended recipient.  Any
>> review, use, distribution, or disclosure by others is strictly prohibited.
>> If you are not the intended recipient (or authorized to receive information
>> for the intended recipient), please contact the sender by reply e-mail and
>> delete all copies of this message.
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Karl Heinz Marbaise-3
Hi,

On 25/10/17 08:50, Stephen Coy wrote:
> Hi Pascal,
>
> Unfortunately this method results in pom files being deployed with releases that do not have corresponding versions in them.
>
> In fact, the version is literally:
>
> <version>${revision}</version>
>
> This results in build warnings for consumers of the released artifact.

If you like to use a property for the version. First you have to use
Maven 3.5.0+ and furthermore flatten-maven-plugin as described in the
docs about that[1].

Kind regards
Karl Heinz Marbaise
[1]: http://maven.apache.org/maven-ci-friendly.html

>
> Cheers,
>
> Steve C
>
>> On 24 Oct 2017, at 8:27 pm, Pascal <[hidden email]> wrote:
>>
>> For me it's hard to understand the problem you are having, it might help to
>> specify the exact errors you are getting.
>>
>> If you are willing to try something other than the release plugin, have a
>> look at https://axelfontaine.com/blog/dead-burried.html
>>
>> Cheers,
>>
>> Pascal
>>
>>
>> 2017-10-23 18:40 GMT+02:00 Justin Georgeson <
>> [hidden email]>:
>>
>>> The 'clean verify' invoked by release:prepare fails in
>>> buildnumber-maven-plugin because pom.xml is modified. I can pass arguments
>>> to release:prepare have buildnumber-maven-plugin skip the check for
>>> modifications, but that check is one of the main motivations for using it
>>> in the first place. What are other people doing here?
>>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: how to use both buildnumber-maven-plugin and maven-release-plugin

Stephen Coy-4
Doh!

I misinterpreted the docs and was thinking that the flatten-maven-plugin was something only needed for multi-module projects…

Thanks for clearing that up.

 Steve C

> On 25 Oct 2017, at 7:46 pm, Karl Heinz Marbaise <[hidden email]> wrote:
>
> Hi,
>
> On 25/10/17 08:50, Stephen Coy wrote:
>> Hi Pascal,
>> Unfortunately this method results in pom files being deployed with releases that do not have corresponding versions in them.
>> In fact, the version is literally:
>> <version>${revision}</version>
>> This results in build warnings for consumers of the released artifact.
>
> If you like to use a property for the version. First you have to use Maven 3.5.0+ and furthermore flatten-maven-plugin as described in the docs about that[1].
>
> Kind regards
> Karl Heinz Marbaise
> [1]: http://maven.apache.org/maven-ci-friendly.html
>
>> Cheers,
>> Steve C
>>> On 24 Oct 2017, at 8:27 pm, Pascal <[hidden email]> wrote:
>>>
>>> For me it's hard to understand the problem you are having, it might help to
>>> specify the exact errors you are getting.
>>>
>>> If you are willing to try something other than the release plugin, have a
>>> look at https://axelfontaine.com/blog/dead-burried.html
>>>
>>> Cheers,
>>>
>>> Pascal
>>>
>>>
>>> 2017-10-23 18:40 GMT+02:00 Justin Georgeson <
>>> [hidden email]>:
>>>
>>>> The 'clean verify' invoked by release:prepare fails in
>>>> buildnumber-maven-plugin because pom.xml is modified. I can pass arguments
>>>> to release:prepare have buildnumber-maven-plugin skip the check for
>>>> modifications, but that check is one of the main motivations for using it
>>>> in the first place. What are other people doing here?
>>>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]