You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Niranjan Deshpande <ni...@gmail.com> on 2008/05/06 10:08:16 UTC

problem using the buildnumber plugin with maven

Hi all

I am using the buildnumber plugin in my pom. details of the plugin are here
http://mojo.codehaus.org/buildnumber-maven-plugin/index.html
http://www.mail-archive.com/users@maven.apache.org/msg60497.html

I have configured the plugin under the
<build>
    <pluginManagement> tags
While taing the build i run this command:

*mvn buildnumber:create install*

The war file generated has name application_Name-Build-r2008-05-05.war
This name is a result of the finalName tag, in the POM:

*
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
*

But when I run

*mvn install*
**
war file that is added to the maven local repository is
application_Name-Build.war, without the timestamp.
This is recult of the version tag in the POM
<version>Build</version>
1.How do i make the intall task, aware of the plugin, and make it run only
after the plugin has been executed.
2. During war creation, build is tagged using the finalName element, but
during installation, its tagged using the version element.
I want it to be tagged using the finalName element in both cases. Is htere a
way to do so?

Please help me.

Re: problem using the buildnumber plugin with maven

Posted by Stephen Connolly <st...@gmail.com>.
the difference is that version has to be evaluated prior to any  
lifecycle phase or plugin execution

if you define a property in your pom it is available when constructing  
the model

the buildnumber plugin is attached to the first phase and the property  
is defined at that point, but by then version had been defined and you  
are stuck

Sent from my iPod

On 5 Sep 2008, at 17:54, Matthias Grunwalde  
<mg...@googlemail.com> wrote:

>
> Wayne, you state that the groupId, artifactId and version are always  
> used
> when publishing to a repo, so I tried specifying ${buildNumber} as the
> version, as in
> <version>${buildNumber}</version>
>
> However, this didn't get interpolated correctly, leading to an  
> artifact in
> my repo called ArtifactId-${buildNumber}.
>
> If I do the same using a "normal" property, as in:
> <version>${my.property}</version>
> ...
> <properties>
>   <my.property>111</my.property>
> </properties>
>
> Then I get an ArtifactId-111 in my repo.
>
> Does this seem like a bug in the build number plugin, that it isn't
> interpolating correctly, or that the ${buildNumber} is a kind of  
> property
> that doesn't get interpolated when specified in a <version>...</ 
> version>
> section?
>
> Is this the same problem as
> http://jira.codehaus.org/browse/MOJO-909
> ?
>
> Kind regards,
> Matthias.
>
>
>
> Wayne Fay wrote:
>>
>> Sorry, I didn't intend to mislead you. I was only trying to address
>> part of your question, the "how do I get buildnumber to put its  
>> number
>> in my artifact's name during the build" part, not the "how do I get
>> that artifact installed with that same name" which, as Wendy says, is
>> not possible.
>>
>> Artifacts always go into the local repo cache using the groupId,
>> artifactId, and version you have declared in the pom -- it completely
>> ignores the finalName.
>>
>> finalName is only useful for changing the name of a war/ear and then
>> pulling it out of /target to use it for something else directly.
>>
>> Wayne
>>
>
> -- 
> View this message in context: http://www.nabble.com/problem-using-the-buildnumber-plugin-with-maven-tp17077968p19335391.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 using the buildnumber plugin with maven

Posted by Matthias Grunwalde <mg...@googlemail.com>.
Wayne, you state that the groupId, artifactId and version are always used
when publishing to a repo, so I tried specifying ${buildNumber} as the
version, as in
 <version>${buildNumber}</version>

However, this didn't get interpolated correctly, leading to an artifact in
my repo called ArtifactId-${buildNumber}.

If I do the same using a "normal" property, as in:
<version>${my.property}</version>
...
<properties>
   <my.property>111</my.property>
</properties>

Then I get an ArtifactId-111 in my repo.

Does this seem like a bug in the build number plugin, that it isn't
interpolating correctly, or that the ${buildNumber} is a kind of property
that doesn't get interpolated when specified in a <version>...</version>
section?

Is this the same problem as
http://jira.codehaus.org/browse/MOJO-909
?

Kind regards,
Matthias.



Wayne Fay wrote:
> 
> Sorry, I didn't intend to mislead you. I was only trying to address
> part of your question, the "how do I get buildnumber to put its number
> in my artifact's name during the build" part, not the "how do I get
> that artifact installed with that same name" which, as Wendy says, is
> not possible.
> 
> Artifacts always go into the local repo cache using the groupId,
> artifactId, and version you have declared in the pom -- it completely
> ignores the finalName.
> 
> finalName is only useful for changing the name of a war/ear and then
> pulling it out of /target to use it for something else directly.
> 
> Wayne
> 

-- 
View this message in context: http://www.nabble.com/problem-using-the-buildnumber-plugin-with-maven-tp17077968p19335391.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 using the buildnumber plugin with maven

Posted by Wayne Fay <wa...@gmail.com>.
Sorry, I didn't intend to mislead you. I was only trying to address
part of your question, the "how do I get buildnumber to put its number
in my artifact's name during the build" part, not the "how do I get
that artifact installed with that same name" which, as Wendy says, is
not possible.

Artifacts always go into the local repo cache using the groupId,
artifactId, and version you have declared in the pom -- it completely
ignores the finalName.

finalName is only useful for changing the name of a war/ear and then
pulling it out of /target to use it for something else directly.

Wayne

On Wed, May 7, 2008 at 9:27 AM, Niranjan Deshpande
<ni...@gmail.com> wrote:
> Yeah, that was my conclusion too. Its surprising that maven developers
>  havent made it changeable at run itme. everytim a new build is taken, u go
>  and edit the pom's version.
>
>
>
>
>
>  On 5/7/08, Wendy Smoak <ws...@gmail.com> wrote:
>  >
>  > On Tue, May 6, 2008 at 1:08 AM, Niranjan Deshpande
>  > <ni...@gmail.com> wrote:
>  >
>  > >  The war file generated has name application_Name-Build-r2008-05-05.war
>  > >  This name is a result of the finalName tag, in the POM:
>  > >  *
>  >
>  > >  <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
>  > >  *
>  > >  But when I run
>  > >  *mvn install*
>  > >  **
>  > >  war file that is added to the maven local repository is
>  > >  application_Name-Build.war, without the timestamp.
>  >
>  > That's always going to be the case.  The finalName only affects the
>  > filename you see in the target directory.  In the local and remote
>  > repos, it will always be just $artifactId-$version.
>  >
>  > --
>  > Wendy
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>  > For additional commands, e-mail: users-help@maven.apache.org
>  >
>  >
>
>
>
>
> --
>  Regards,
>  Niranjan Deshpande
>
>  "Shut yourself from the world and create the reality you want"
>

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


Re: problem using the buildnumber plugin with maven

Posted by Niranjan Deshpande <ni...@gmail.com>.
Yeah, that was my conclusion too. Its surprising that maven developers
havent made it changeable at run itme. everytim a new build is taken, u go
and edit the pom's version.



On 5/7/08, Wendy Smoak <ws...@gmail.com> wrote:
>
> On Tue, May 6, 2008 at 1:08 AM, Niranjan Deshpande
> <ni...@gmail.com> wrote:
>
> >  The war file generated has name application_Name-Build-r2008-05-05.war
> >  This name is a result of the finalName tag, in the POM:
> >  *
>
> >  <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
> >  *
> >  But when I run
> >  *mvn install*
> >  **
> >  war file that is added to the maven local repository is
> >  application_Name-Build.war, without the timestamp.
>
> That's always going to be the case.  The finalName only affects the
> filename you see in the target directory.  In the local and remote
> repos, it will always be just $artifactId-$version.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Regards,
Niranjan Deshpande

"Shut yourself from the world and create the reality you want"

Re: problem using the buildnumber plugin with maven

Posted by Wendy Smoak <ws...@gmail.com>.
On Tue, May 6, 2008 at 1:08 AM, Niranjan Deshpande
<ni...@gmail.com> wrote:

>  The war file generated has name application_Name-Build-r2008-05-05.war
>  This name is a result of the finalName tag, in the POM:
>  *
>  <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
>  *
>  But when I run
>  *mvn install*
>  **
>  war file that is added to the maven local repository is
>  application_Name-Build.war, without the timestamp.

That's always going to be the case.  The finalName only affects the
filename you see in the target directory.  In the local and remote
repos, it will always be just $artifactId-$version.

-- 
Wendy

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


Re: problem using the buildnumber plugin with maven

Posted by Niranjan Deshpande <ni...@gmail.com>.
<execution>
                  <phase>*compile*</phase>
            <goals>
                <goal>create</goal>
            </goals>
          </execution>

You mean to say I should do as above for hte mojo? I tried even that. but
you know what the mojo never runs unless u reun it explicitly as
*mvn buildnumber:create install*

*So the problem still remains: How do I make my install goal, aware of the
build number plugin?*





On 5/7/08, Wayne Fay <wa...@gmail.com> wrote:
>
> You need to bind the execution of the buildnumber:create mojo to a
> Maven phase prior to install, eg compile.
>
> Wayne
>
> On Tue, May 6, 2008 at 3:08 AM, Niranjan Deshpande
> <ni...@gmail.com> wrote:
> > Hi all
> >
> >  I am using the buildnumber plugin in my pom. details of the plugin are
> here
> >  http://mojo.codehaus.org/buildnumber-maven-plugin/index.html
> >  http://www.mail-archive.com/users@maven.apache.org/msg60497.html
> >
> >  I have configured the plugin under the
> >  <build>
> >     <pluginManagement> tags
> >  While taing the build i run this command:
> >
> >  *mvn buildnumber:create install*
> >
> >  The war file generated has name application_Name-Build-r2008-05-05.war
> >  This name is a result of the finalName tag, in the POM:
> >
> >  *
>
> >  <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
> >  *
> >
> >  But when I run
> >
> >  *mvn install*
> >  **
> >  war file that is added to the maven local repository is
> >  application_Name-Build.war, without the timestamp.
> >  This is recult of the version tag in the POM
> >  <version>Build</version>
> >  1.How do i make the intall task, aware of the plugin, and make it run
> only
> >  after the plugin has been executed.
> >  2. During war creation, build is tagged using the finalName element,
> but
> >  during installation, its tagged using the version element.
> >  I want it to be tagged using the finalName element in both cases. Is
> htere a
> >  way to do so?
> >
> >  Please help me.
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Regards,
Niranjan Deshpande

"Shut yourself from the world and create the reality you want"

Re: problem using the buildnumber plugin with maven

Posted by Wayne Fay <wa...@gmail.com>.
You need to bind the execution of the buildnumber:create mojo to a
Maven phase prior to install, eg compile.

Wayne

On Tue, May 6, 2008 at 3:08 AM, Niranjan Deshpande
<ni...@gmail.com> wrote:
> Hi all
>
>  I am using the buildnumber plugin in my pom. details of the plugin are here
>  http://mojo.codehaus.org/buildnumber-maven-plugin/index.html
>  http://www.mail-archive.com/users@maven.apache.org/msg60497.html
>
>  I have configured the plugin under the
>  <build>
>     <pluginManagement> tags
>  While taing the build i run this command:
>
>  *mvn buildnumber:create install*
>
>  The war file generated has name application_Name-Build-r2008-05-05.war
>  This name is a result of the finalName tag, in the POM:
>
>  *
>  <finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
>  *
>
>  But when I run
>
>  *mvn install*
>  **
>  war file that is added to the maven local repository is
>  application_Name-Build.war, without the timestamp.
>  This is recult of the version tag in the POM
>  <version>Build</version>
>  1.How do i make the intall task, aware of the plugin, and make it run only
>  after the plugin has been executed.
>  2. During war creation, build is tagged using the finalName element, but
>  during installation, its tagged using the version element.
>  I want it to be tagged using the finalName element in both cases. Is htere a
>  way to do so?
>
>  Please help me.
>

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