You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Karl Heinz Marbaise <ka...@soebes.de> on 2010/01/19 17:08:02 UTC

Problem with buildnumber-maven-plugin

Hi,

I have a large project which comprises of many modules and sub-modules and
inheritance structure....


   root
    +--- Module 1
            +-- Module 1.1
    +--- Module 2
            +-- Module 2.1



Now i would like to get the SCM Version with the buildnumber-maven-plugin
which works....and i've tried to create a timestamp with
buildnumber-maven-plugin....

But now the problem arises....In every module the buildnumber-maven-plugin
will be executed which means the timestamp changes over the different
modules....

I have configured the buildnumber-maven-plugin in my Root Module:



     &lt;build&gt;
        &lt;plugins&gt;
          &lt;plugin&gt;
                &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
               
&lt;artifactId&gt;buildnumber-maven-plugin&lt;/artifactId&gt;
                &lt;executions&gt;
                    &lt;execution&gt;
                        &lt;id&gt;buildNumber-scm&lt;/id&gt;
                        &lt;phase&gt;validate&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;create&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                           
&lt;getRevisionOnce&gt;true&lt;/getRevisionOnce&gt;
                            &lt;doCheck&gt;false&lt;/doCheck&gt;
                            &lt;doUpdate&gt;false&lt;/doUpdate&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                    &lt;execution&gt;
                        &lt;id&gt;buildNumberTimeStamp&lt;/id&gt;
                        &lt;phase&gt;validate&lt;/phase&gt;
                        &lt;goals&gt;
                            &lt;goal&gt;create&lt;/goal&gt;
                        &lt;/goals&gt;
                        &lt;configuration&gt;
                           
&lt;buildNumberPropertyName&gt;buildTimeStamp&lt;/buildNumberPropertyName&gt;
                            &lt;format&gt;{0,date,yyyy-MM-dd
HH:mm:ss}&lt;/format&gt;
                            &lt;items&gt;
                                &lt;item&gt;timestamp&lt;/item&gt;
                            &lt;/items&gt;
                            &lt;doCheck&gt;false&lt;/doCheck&gt;
                            &lt;doUpdate&gt;false&lt;/doUpdate&gt;
                        &lt;/configuration&gt;
                    &lt;/execution&gt;
                &lt;/executions&gt;
            &lt;/plugin&gt;
....


So what i need is to create a timestamp only once during a build....(e.g. on
Root-Level) ?

Is this possible with Maven (2.2.1 / 3.0 - Alpha ...).

Or might be the best way to create such a timestamp via CI Server (in my
case Hudson)?

Kind regards
Karl Heinz Marbaise
-- 
View this message in context: http://old.nabble.com/Problem-with-buildnumber-maven-plugin-tp27228183p27228183.html
Sent from the Maven - Users mailing list archive at Nabble.com.

RE: Problem with buildnumber-maven-plugin

Posted by Todd Thiessen <tt...@avaya.com>.
Thanks for the clarification. That makes more sense.

I agree. I sounds like you don't really want the timestamp from the buildnumber plugin.

---
Todd Thiessen
 

> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:khmarbaise@gmx.de] 
> Sent: Tuesday, January 19, 2010 6:21 PM
> To: Maven Users List
> Subject: Re: Problem with buildnumber-maven-plugin
> 
> Hi Todd,
> 
> >> My problem is
> >> exactly the timestamp....cause on the build time of each 
> module the 
> >> timestamp is changing ....over my tree....
> >>
> > 
> > I guess I don't really understand what the problem with 
> this is ;-). 
> > The build time each module's artifact IS actually different.
> Yeah that's what i understood and expected...
> 
>  > If your not
> > interested in the built time of the module, then I can't really see 
> > why your module needs a build time.
> May be i didn't explain my intention good enough...
> 
> I would like to create a timestamp starting with the build 
> (root of my reactor build) to use this timestamp for 
> different things (Overall Site information, put the 
> information into different SQL Scripts, Shell-Scripts, RPM 
> Comment etc.)...
> 
> That means i would like to record the start time of my build....
> 
> So may be i misunderstnad the intention of the 
> buildnumber-maven-plugin....May be i have to use and external 
> source for this kind of information e.g. Hudson...but i 
> thought i could manage it with Maven itself...
> 
> Many thanks for your help.
> 
> Kind regards
> Karl Heinz Marbaise
> -- 
> SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
> Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
> Hauptstrasse 177                         USt.IdNr: DE191347579
> 52146 Würselen                           http://www.soebes.de
> 
> ---------------------------------------------------------------------
> 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: Problem with buildnumber-maven-plugin

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

>> My problem is 
>> exactly the timestamp....cause on the build time of each 
>> module the timestamp is changing ....over my tree....
>>
> 
> I guess I don't really understand what the problem with this is ;-). The
> build time each module's artifact IS actually different. 
Yeah that's what i understood and expected...

 > If your not
> interested in the built time of the module, then I can't really see why
> your module needs a build time.
May be i didn't explain my intention good enough...

I would like to create a timestamp starting with the build (root of my 
reactor build) to use this timestamp for different things (Overall Site 
information, put the information into different SQL Scripts, 
Shell-Scripts, RPM Comment etc.)...

That means i would like to record the start time of my build....

So may be i misunderstnad the intention of the 
buildnumber-maven-plugin....May be i have to use and external source for 
this kind of information e.g. Hudson...but i thought i could manage it 
with Maven itself...

Many thanks for your help.

Kind regards
Karl Heinz Marbaise
-- 
SoftwareEntwicklung Beratung Schulung    Tel.: +49 (0) 2405 / 415 893
Dipl.Ing.(FH) Karl Heinz Marbaise        ICQ#: 135949029
Hauptstrasse 177                         USt.IdNr: DE191347579
52146 Würselen                           http://www.soebes.de

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


RE: Problem with buildnumber-maven-plugin

Posted by Todd Thiessen <tt...@avaya.com>.
> My problem is 
> exactly the timestamp....cause on the build time of each 
> module the timestamp is changing ....over my tree....
> 

I guess I don't really understand what the problem with this is ;-). The
build time each module's artifact IS actually different. If your not
interested in the built time of the module, then I can't really see why
your module needs a build time.

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


RE: Problem with buildnumber-maven-plugin

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,


tthiessen wrote:
> 
> The svn revision stays the same right?Yeah the svn revision number does
> not change, but which is not my problem...

 Do you even care about the timestamp?</quote]
My problem is exactly the timestamp....cause on the build time of each
module the timestamp is changing ....over my tree....

So may be i have to decide to use one injected from outside (e.g. from
Hudson) or command line....

Kind regards
Karl Heinz Marbaise

-- 
View this message in context: http://old.nabble.com/Problem-with-buildnumber-maven-plugin-tp27228183p27229732.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: Problem with buildnumber-maven-plugin

Posted by Todd Thiessen <tt...@avaya.com>.
The svn revision stays the same right? Do you even care about the time
stamp?

---
Todd Thiessen
 

> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:kama@soebes.de] 
> Sent: Tuesday, January 19, 2010 11:56 AM
> To: users@maven.apache.org
> Subject: RE: Problem with buildnumber-maven-plugin
> 
> 
> Hi,
> first thanks for your answer...
> 
> 
> tthiessen wrote:
> > 
> > Can't you create the build number in your final build project?
> > 
> > For example, if your final artifact is a war, you create the build 
> > number only in that war project.
> > 
> > Do you really need a build number in all dependency modules?
> 
> Yes i need it, because i have around 100 Modules which 
> results in RPM's (built with Maven) and i need the 
> buildnumber (SVN Revision)....to indicate the different build 
> states i create...The version in the modules is based on 
> inheritance is not a problem....
> 
> The problem is that the buildnumber-maven-plugin is called 
> for every modules in the inheritance tree if i do an reactor 
> build from the root of my tree...The result is that the 
> timestamp in this case is changed with every call....
> 
> Kind regards
> Karl Heinz Marbaise
> 
> 
> 
> --
> View this message in context: 
> http://old.nabble.com/Problem-with-buildnumber-maven-plugin-tp
> 27228183p27228940.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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: Problem with buildnumber-maven-plugin

Posted by Karl Heinz Marbaise <ka...@soebes.de>.
Hi,
first thanks for your answer...


tthiessen wrote:
> 
> Can't you create the build number in your final build project?
> 
> For example, if your final artifact is a war, you create the build
> number only in that war project.
> 
> Do you really need a build number in all dependency modules?

Yes i need it, because i have around 100 Modules which results in RPM's
(built with Maven) and i need the buildnumber (SVN Revision)....to indicate
the different build states i create...The version in the modules is based on
inheritance is not a problem....

The problem is that the buildnumber-maven-plugin is called for every modules
in the inheritance tree if i do an reactor build from the root of my
tree...The result is that the timestamp in this case is changed with every
call....

Kind regards
Karl Heinz Marbaise



-- 
View this message in context: http://old.nabble.com/Problem-with-buildnumber-maven-plugin-tp27228183p27228940.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: Problem with buildnumber-maven-plugin

Posted by Todd Thiessen <tt...@avaya.com>.
Can't you create the build number in your final build project?

For example, if your final artifact is a war, you create the build
number only in that war project.

Do you really need a build number in all dependency modules?

---
Todd Thiessen
 

> -----Original Message-----
> From: Karl Heinz Marbaise [mailto:kama@soebes.de] 
> Sent: Tuesday, January 19, 2010 11:08 AM
> To: users@maven.apache.org
> Subject: Problem with buildnumber-maven-plugin
> 
> 
> Hi,
> 
> I have a large project which comprises of many modules and 
> sub-modules and inheritance structure....
> 
> 
>    root
>     +--- Module 1
>             +-- Module 1.1
>     +--- Module 2
>             +-- Module 2.1
> 
> 
> 
> Now i would like to get the SCM Version with the 
> buildnumber-maven-plugin which works....and i've tried to 
> create a timestamp with buildnumber-maven-plugin....
> 
> But now the problem arises....In every module the 
> buildnumber-maven-plugin will be executed which means the 
> timestamp changes over the different modules....
> 
> I have configured the buildnumber-maven-plugin in my Root Module:
> 
> 
> 
>      &lt;build&gt;
>         &lt;plugins&gt;
>           &lt;plugin&gt;
>                 &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt;
>                
> &lt;artifactId&gt;buildnumber-maven-plugin&lt;/artifactId&gt;
>                 &lt;executions&gt;
>                     &lt;execution&gt;
>                         &lt;id&gt;buildNumber-scm&lt;/id&gt;
>                         &lt;phase&gt;validate&lt;/phase&gt;
>                         &lt;goals&gt;
>                             &lt;goal&gt;create&lt;/goal&gt;
>                         &lt;/goals&gt;
>                         &lt;configuration&gt;
>                            
> &lt;getRevisionOnce&gt;true&lt;/getRevisionOnce&gt;
>                             &lt;doCheck&gt;false&lt;/doCheck&gt;
>                             &lt;doUpdate&gt;false&lt;/doUpdate&gt;
>                         &lt;/configuration&gt;
>                     &lt;/execution&gt;
>                     &lt;execution&gt;
>                         &lt;id&gt;buildNumberTimeStamp&lt;/id&gt;
>                         &lt;phase&gt;validate&lt;/phase&gt;
>                         &lt;goals&gt;
>                             &lt;goal&gt;create&lt;/goal&gt;
>                         &lt;/goals&gt;
>                         &lt;configuration&gt;
>                            
> &lt;buildNumberPropertyName&gt;buildTimeStamp&lt;/buildNumberP
> ropertyName&gt;
>                             &lt;format&gt;{0,date,yyyy-MM-dd 
> HH:mm:ss}&lt;/format&gt;
>                             &lt;items&gt;
>                                 &lt;item&gt;timestamp&lt;/item&gt;
>                             &lt;/items&gt;
>                             &lt;doCheck&gt;false&lt;/doCheck&gt;
>                             &lt;doUpdate&gt;false&lt;/doUpdate&gt;
>                         &lt;/configuration&gt;
>                     &lt;/execution&gt;
>                 &lt;/executions&gt;
>             &lt;/plugin&gt;
> ....
> 
> 
> So what i need is to create a timestamp only once during a 
> build....(e.g. on
> Root-Level) ?
> 
> Is this possible with Maven (2.2.1 / 3.0 - Alpha ...).
> 
> Or might be the best way to create such a timestamp via CI 
> Server (in my case Hudson)?
> 
> Kind regards
> Karl Heinz Marbaise
> --
> View this message in context: 
> http://old.nabble.com/Problem-with-buildnumber-maven-plugin-tp
> 27228183p27228183.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
> 

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