You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Raffaele <r....@prismasw.it> on 2008/11/20 14:52:42 UTC

Project versioning

Hi all,

I would like some advices about how automatically update a properties file
inserting into an incremental value representing the build number....

My scenario:
- I have a web application and I would like to insert in some page, the
build version....
- I would like to know if is there a way to obtain the project version from
the java code in a way that I'm able to insert a label showing that
version...
- If there wasn't such a way, I was thinking to write project version in a
file, then from java code I would read that file and would update my
label...

Have you got any idea? Obviously I would like to take advantage of Maven and
I would prefer to avoid another file....

Thanks in advance,
Raffaele Gambelli
-- 
View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20601486.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: Project versioning

Posted by Raffaele <r....@prismasw.it>.
Thanks Brian, but
could you point me to some snippet/example/doc about filtering ?

However, are you saying something like this -->
- I write a properties file inserting a property, for example "version =
${version}"
- "mvn package" valorizes that properties file with current version number

?

Thanks again and best regards
Raffaele Gambelli


Brian E Fox wrote:
> 
> Normally you just have a properties file that is filtered during the
> build and at runtime your code reads the value.
> 
> -----Original Message-----
> From: Raffaele [mailto:r.gambelli@prismasw.it] 
> Sent: Thursday, November 20, 2008 8:53 AM
> To: users@maven.apache.org
> Subject: Project versioning
> 
> 
> Hi all,
> 
> I would like some advices about how automatically update a properties
> file
> inserting into an incremental value representing the build number....
> 
> My scenario:
> - I have a web application and I would like to insert in some page, the
> build version....
> - I would like to know if is there a way to obtain the project version
> from
> the java code in a way that I'm able to insert a label showing that
> version...
> - If there wasn't such a way, I was thinking to write project version in
> a
> file, then from java code I would read that file and would update my
> label...
> 
> Have you got any idea? Obviously I would like to take advantage of Maven
> and
> I would prefer to avoid another file....
> 
> Thanks in advance,
> Raffaele Gambelli
> -- 
> View this message in context:
> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20601747.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: Project versioning

Posted by Stephen Connolly <st...@gmail.com>.
version=${project.version}.${someotherproperty}

2008/11/21 Raffaele <r....@prismasw.it>

>
> Hi Stephen,
> thanks to advice to use buildnumber plugin, I didn't know it before...
> Now, please be patient, can you explain me better the meaning of "and
> filter
> in the project version *and* the
> build number" ?
>
> Thanks again
> regards
> Raffaele
>
>
> Stephen Connolly-2 wrote:
> >
> > use the buildnumber plugin and filter in the project version *and* the
> > build number
> >
> > Sent from my iPod
> >
> > On 20 Nov 2008, at 17:13, Raffaele <r....@prismasw.it> wrote:
> >
> >>
> >> Hi,
> >> unfortunately I'm here again....my boss is not satisfied with this
> >> solution:
> >> - Due to old consuetudes he would like the following scenario:
> >> 1) In the pom version tag, he wants specify only Major.Minor, ex: 1.5
> >> 2) In the file (version.cfg) that will be read by java code to show
> >> a label
> >> informing user about product build number, he wants that an automatic
> >> process append to Major.Minor (taken from pom during build phase)
> >> another
> >> version, example 1.5.562
> >> 3) He wants that, each time I run "mvn package", maven updates that
> >> file
> >> incrementing by one that number....
> >>
> >> Do you believe is it possible doing it with maven?
> >>
> >> Thanks in advance and scuse me again.... (I'm agree with your
> >> vision, my
> >> boss not :-) )
> >>
> >> Best regards
> >> Raffaele
> >>
> >>
> >>
> >> Stephen Connolly-2 wrote:
> >>>
> >>> I always rejig my resources folders so that I have
> >>>
> >>> src/main/resources/filtered
> >>> src/main/resources/verbatim
> >>> src/test/resources/filtered
> >>> src/test/resources/verbatim
> >>>
> >>> If only I could come up with a good version for webapps
> >>>
> >>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> >>>
> >>>> No you can't filter only one file that I recall, but you can make
> >>>> something like src/main/filtered-resources and enable filtering on
> >>>> that
> >>>> folder only.
> >>>>
> >>>> -----Original Message-----
> >>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
> >>>> Sent: Thursday, November 20, 2008 10:00 AM
> >>>> To: users@maven.apache.org
> >>>> Subject: Re: Project versioning
> >>>>
> >>>>
> >>>> Ok guys thank you all,
> >>>>
> >>>> There is only one thing that I'm continuing to not understand....
> >>>> In my src/main/resources I have many many files.....
> >>>> I would like to filter only one of those files....
> >>>> but putting this in my pom
> >>>>
> >>>> <resources>
> >>>>       <resource>
> >>>>               <directory>src/main/resources</directory>
> >>>>              <filtering>true</filtering>
> >>>>       </resource>
> >>>> </resources>
> >>>>
> >>>> has effect to try to filter all the files....
> >>>> How could I say maven to filter only one specific file and not a
> >>>> full
> >>>> folder?
> >>>>
> >>>> Best regards
> >>>> Raffaele
> >>>>
> >>>>
> >>>> Stephen Connolly-2 wrote:
> >>>>>
> >>>>> Alternatively, you could pull the version info from the pom.xml
> >>>>> that
> >>>> gets
> >>>>> stashed in a sub-folder of META-INF by default.... but this might
> >>>> require
> >>>>> a
> >>>>> bit of work since the version could have been inherited from the
> >>>> parent
> >>>>> version...
> >>>>>
> >>>>> Safest way is as Brian suggests... and it has the added advantage
> >>>>> of
> >>>> not
> >>>>> tieing you to maven for your build.
> >>>>>
> >>>>> What we do is we have a properties file with
> >>>>>
> >>>>> version=${project.version}
> >>>>>
> >>>>> as the only entry.  We then turn on filtering for that properties
> >>>> file,
> >>>>> and
> >>>>> to access it from code we just use getClass().getResource("/path to
> >>>>> versions.properties")
> >>>>>
> >>>>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> >>>>>
> >>>>>> Normally you just have a properties file that is filtered during
> >>>>>> the
> >>>>>> build and at runtime your code reads the value.
> >>>>>>
> >>>>>> -----Original Message-----
> >>>>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
> >>>>>> Sent: Thursday, November 20, 2008 8:53 AM
> >>>>>> To: users@maven.apache.org
> >>>>>> Subject: Project versioning
> >>>>>>
> >>>>>>
> >>>>>> Hi all,
> >>>>>>
> >>>>>> I would like some advices about how automatically update a
> >>>>>> properties
> >>>>>> file
> >>>>>> inserting into an incremental value representing the build
> >>>>>> number....
> >>>>>>
> >>>>>> My scenario:
> >>>>>> - I have a web application and I would like to insert in some
> >>>>>> page,
> >>>> the
> >>>>>> build version....
> >>>>>> - I would like to know if is there a way to obtain the project
> >>>> version
> >>>>>> from
> >>>>>> the java code in a way that I'm able to insert a label showing
> >>>>>> that
> >>>>>> version...
> >>>>>> - If there wasn't such a way, I was thinking to write project
> >>>>>> version
> >>>> in
> >>>>>> a
> >>>>>> file, then from java code I would read that file and would
> >>>>>> update my
> >>>>>> label...
> >>>>>>
> >>>>>> Have you got any idea? Obviously I would like to take advantage of
> >>>> Maven
> >>>>>> and
> >>>>>> I would prefer to avoid another file....
> >>>>>>
> >>>>>> Thanks in advance,
> >>>>>> Raffaele Gambelli
> >>>>>> --
> >>>>>> View this message in context:
> >>>>>> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
> >>>>>>
> >>>>>>
> >>>>>
> >>>>>
> >>>>
> >>>> --
> >>>> View this message in context:
> >>>> http://www.nabble.com/Project-versioning-tp20601486p20603012.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
> >>>>
> >>>>
> >>>
> >>>
> >>
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Project-versioning-tp20601486p20605912.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
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Project-versioning-tp20601486p20625116.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: Project versioning

Posted by Raffaele <r....@prismasw.it>.
Hi Stephen,
thanks to advice to use buildnumber plugin, I didn't know it before...
Now, please be patient, can you explain me better the meaning of "and filter
in the project version *and* the  
build number" ?

Thanks again
regards
Raffaele


Stephen Connolly-2 wrote:
> 
> use the buildnumber plugin and filter in the project version *and* the  
> build number
> 
> Sent from my iPod
> 
> On 20 Nov 2008, at 17:13, Raffaele <r....@prismasw.it> wrote:
> 
>>
>> Hi,
>> unfortunately I'm here again....my boss is not satisfied with this  
>> solution:
>> - Due to old consuetudes he would like the following scenario:
>> 1) In the pom version tag, he wants specify only Major.Minor, ex: 1.5
>> 2) In the file (version.cfg) that will be read by java code to show  
>> a label
>> informing user about product build number, he wants that an automatic
>> process append to Major.Minor (taken from pom during build phase)  
>> another
>> version, example 1.5.562
>> 3) He wants that, each time I run "mvn package", maven updates that  
>> file
>> incrementing by one that number....
>>
>> Do you believe is it possible doing it with maven?
>>
>> Thanks in advance and scuse me again.... (I'm agree with your  
>> vision, my
>> boss not :-) )
>>
>> Best regards
>> Raffaele
>>
>>
>>
>> Stephen Connolly-2 wrote:
>>>
>>> I always rejig my resources folders so that I have
>>>
>>> src/main/resources/filtered
>>> src/main/resources/verbatim
>>> src/test/resources/filtered
>>> src/test/resources/verbatim
>>>
>>> If only I could come up with a good version for webapps
>>>
>>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
>>>
>>>> No you can't filter only one file that I recall, but you can make
>>>> something like src/main/filtered-resources and enable filtering on  
>>>> that
>>>> folder only.
>>>>
>>>> -----Original Message-----
>>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>>>> Sent: Thursday, November 20, 2008 10:00 AM
>>>> To: users@maven.apache.org
>>>> Subject: Re: Project versioning
>>>>
>>>>
>>>> Ok guys thank you all,
>>>>
>>>> There is only one thing that I'm continuing to not understand....
>>>> In my src/main/resources I have many many files.....
>>>> I would like to filter only one of those files....
>>>> but putting this in my pom
>>>>
>>>> <resources>
>>>>       <resource>
>>>>               <directory>src/main/resources</directory>
>>>>              <filtering>true</filtering>
>>>>       </resource>
>>>> </resources>
>>>>
>>>> has effect to try to filter all the files....
>>>> How could I say maven to filter only one specific file and not a  
>>>> full
>>>> folder?
>>>>
>>>> Best regards
>>>> Raffaele
>>>>
>>>>
>>>> Stephen Connolly-2 wrote:
>>>>>
>>>>> Alternatively, you could pull the version info from the pom.xml  
>>>>> that
>>>> gets
>>>>> stashed in a sub-folder of META-INF by default.... but this might
>>>> require
>>>>> a
>>>>> bit of work since the version could have been inherited from the
>>>> parent
>>>>> version...
>>>>>
>>>>> Safest way is as Brian suggests... and it has the added advantage  
>>>>> of
>>>> not
>>>>> tieing you to maven for your build.
>>>>>
>>>>> What we do is we have a properties file with
>>>>>
>>>>> version=${project.version}
>>>>>
>>>>> as the only entry.  We then turn on filtering for that properties
>>>> file,
>>>>> and
>>>>> to access it from code we just use getClass().getResource("/path to
>>>>> versions.properties")
>>>>>
>>>>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
>>>>>
>>>>>> Normally you just have a properties file that is filtered during  
>>>>>> the
>>>>>> build and at runtime your code reads the value.
>>>>>>
>>>>>> -----Original Message-----
>>>>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>>>>>> Sent: Thursday, November 20, 2008 8:53 AM
>>>>>> To: users@maven.apache.org
>>>>>> Subject: Project versioning
>>>>>>
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I would like some advices about how automatically update a  
>>>>>> properties
>>>>>> file
>>>>>> inserting into an incremental value representing the build  
>>>>>> number....
>>>>>>
>>>>>> My scenario:
>>>>>> - I have a web application and I would like to insert in some  
>>>>>> page,
>>>> the
>>>>>> build version....
>>>>>> - I would like to know if is there a way to obtain the project
>>>> version
>>>>>> from
>>>>>> the java code in a way that I'm able to insert a label showing  
>>>>>> that
>>>>>> version...
>>>>>> - If there wasn't such a way, I was thinking to write project  
>>>>>> version
>>>> in
>>>>>> a
>>>>>> file, then from java code I would read that file and would  
>>>>>> update my
>>>>>> label...
>>>>>>
>>>>>> Have you got any idea? Obviously I would like to take advantage of
>>>> Maven
>>>>>> and
>>>>>> I would prefer to avoid another file....
>>>>>>
>>>>>> Thanks in advance,
>>>>>> Raffaele Gambelli
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Project-versioning-tp20601486p20603012.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
>>>>
>>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/Project-versioning-tp20601486p20605912.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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20625116.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: Project versioning

Posted by Stephen Connolly <st...@gmail.com>.
use the buildnumber plugin and filter in the project version *and* the  
build number

Sent from my iPod

On 20 Nov 2008, at 17:13, Raffaele <r....@prismasw.it> wrote:

>
> Hi,
> unfortunately I'm here again....my boss is not satisfied with this  
> solution:
> - Due to old consuetudes he would like the following scenario:
> 1) In the pom version tag, he wants specify only Major.Minor, ex: 1.5
> 2) In the file (version.cfg) that will be read by java code to show  
> a label
> informing user about product build number, he wants that an automatic
> process append to Major.Minor (taken from pom during build phase)  
> another
> version, example 1.5.562
> 3) He wants that, each time I run "mvn package", maven updates that  
> file
> incrementing by one that number....
>
> Do you believe is it possible doing it with maven?
>
> Thanks in advance and scuse me again.... (I'm agree with your  
> vision, my
> boss not :-) )
>
> Best regards
> Raffaele
>
>
>
> Stephen Connolly-2 wrote:
>>
>> I always rejig my resources folders so that I have
>>
>> src/main/resources/filtered
>> src/main/resources/verbatim
>> src/test/resources/filtered
>> src/test/resources/verbatim
>>
>> If only I could come up with a good version for webapps
>>
>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
>>
>>> No you can't filter only one file that I recall, but you can make
>>> something like src/main/filtered-resources and enable filtering on  
>>> that
>>> folder only.
>>>
>>> -----Original Message-----
>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>>> Sent: Thursday, November 20, 2008 10:00 AM
>>> To: users@maven.apache.org
>>> Subject: Re: Project versioning
>>>
>>>
>>> Ok guys thank you all,
>>>
>>> There is only one thing that I'm continuing to not understand....
>>> In my src/main/resources I have many many files.....
>>> I would like to filter only one of those files....
>>> but putting this in my pom
>>>
>>> <resources>
>>>       <resource>
>>>               <directory>src/main/resources</directory>
>>>              <filtering>true</filtering>
>>>       </resource>
>>> </resources>
>>>
>>> has effect to try to filter all the files....
>>> How could I say maven to filter only one specific file and not a  
>>> full
>>> folder?
>>>
>>> Best regards
>>> Raffaele
>>>
>>>
>>> Stephen Connolly-2 wrote:
>>>>
>>>> Alternatively, you could pull the version info from the pom.xml  
>>>> that
>>> gets
>>>> stashed in a sub-folder of META-INF by default.... but this might
>>> require
>>>> a
>>>> bit of work since the version could have been inherited from the
>>> parent
>>>> version...
>>>>
>>>> Safest way is as Brian suggests... and it has the added advantage  
>>>> of
>>> not
>>>> tieing you to maven for your build.
>>>>
>>>> What we do is we have a properties file with
>>>>
>>>> version=${project.version}
>>>>
>>>> as the only entry.  We then turn on filtering for that properties
>>> file,
>>>> and
>>>> to access it from code we just use getClass().getResource("/path to
>>>> versions.properties")
>>>>
>>>> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
>>>>
>>>>> Normally you just have a properties file that is filtered during  
>>>>> the
>>>>> build and at runtime your code reads the value.
>>>>>
>>>>> -----Original Message-----
>>>>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>>>>> Sent: Thursday, November 20, 2008 8:53 AM
>>>>> To: users@maven.apache.org
>>>>> Subject: Project versioning
>>>>>
>>>>>
>>>>> Hi all,
>>>>>
>>>>> I would like some advices about how automatically update a  
>>>>> properties
>>>>> file
>>>>> inserting into an incremental value representing the build  
>>>>> number....
>>>>>
>>>>> My scenario:
>>>>> - I have a web application and I would like to insert in some  
>>>>> page,
>>> the
>>>>> build version....
>>>>> - I would like to know if is there a way to obtain the project
>>> version
>>>>> from
>>>>> the java code in a way that I'm able to insert a label showing  
>>>>> that
>>>>> version...
>>>>> - If there wasn't such a way, I was thinking to write project  
>>>>> version
>>> in
>>>>> a
>>>>> file, then from java code I would read that file and would  
>>>>> update my
>>>>> label...
>>>>>
>>>>> Have you got any idea? Obviously I would like to take advantage of
>>> Maven
>>>>> and
>>>>> I would prefer to avoid another file....
>>>>>
>>>>> Thanks in advance,
>>>>> Raffaele Gambelli
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
>>>>>
>>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Project-versioning-tp20601486p20603012.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
>>>
>>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20605912.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: Project versioning

Posted by Raffaele <r....@prismasw.it>.
Hi,
unfortunately I'm here again....my boss is not satisfied with this solution:
- Due to old consuetudes he would like the following scenario:
1) In the pom version tag, he wants specify only Major.Minor, ex: 1.5
2) In the file (version.cfg) that will be read by java code to show a label
informing user about product build number, he wants that an automatic
process append to Major.Minor (taken from pom during build phase) another
version, example 1.5.562
3) He wants that, each time I run "mvn package", maven updates that file
incrementing by one that number....

Do you believe is it possible doing it with maven?

Thanks in advance and scuse me again.... (I'm agree with your vision, my
boss not :-) )

Best regards
Raffaele



Stephen Connolly-2 wrote:
> 
> I always rejig my resources folders so that I have
> 
> src/main/resources/filtered
> src/main/resources/verbatim
> src/test/resources/filtered
> src/test/resources/verbatim
> 
> If only I could come up with a good version for webapps
> 
> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> 
>> No you can't filter only one file that I recall, but you can make
>> something like src/main/filtered-resources and enable filtering on that
>> folder only.
>>
>> -----Original Message-----
>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>> Sent: Thursday, November 20, 2008 10:00 AM
>> To: users@maven.apache.org
>> Subject: Re: Project versioning
>>
>>
>> Ok guys thank you all,
>>
>> There is only one thing that I'm continuing to not understand....
>> In my src/main/resources I have many many files.....
>> I would like to filter only one of those files....
>> but putting this in my pom
>>
>> <resources>
>>        <resource>
>>                <directory>src/main/resources</directory>
>>               <filtering>true</filtering>
>>        </resource>
>> </resources>
>>
>> has effect to try to filter all the files....
>> How could I say maven to filter only one specific file and not a full
>> folder?
>>
>> Best regards
>> Raffaele
>>
>>
>> Stephen Connolly-2 wrote:
>> >
>> > Alternatively, you could pull the version info from the pom.xml that
>> gets
>> > stashed in a sub-folder of META-INF by default.... but this might
>> require
>> > a
>> > bit of work since the version could have been inherited from the
>> parent
>> > version...
>> >
>> > Safest way is as Brian suggests... and it has the added advantage of
>> not
>> > tieing you to maven for your build.
>> >
>> > What we do is we have a properties file with
>> >
>> > version=${project.version}
>> >
>> > as the only entry.  We then turn on filtering for that properties
>> file,
>> > and
>> > to access it from code we just use getClass().getResource("/path to
>> > versions.properties")
>> >
>> > 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
>> >
>> >> Normally you just have a properties file that is filtered during the
>> >> build and at runtime your code reads the value.
>> >>
>> >> -----Original Message-----
>> >> From: Raffaele [mailto:r.gambelli@prismasw.it]
>> >> Sent: Thursday, November 20, 2008 8:53 AM
>> >> To: users@maven.apache.org
>> >> Subject: Project versioning
>> >>
>> >>
>> >> Hi all,
>> >>
>> >> I would like some advices about how automatically update a properties
>> >> file
>> >> inserting into an incremental value representing the build number....
>> >>
>> >> My scenario:
>> >> - I have a web application and I would like to insert in some page,
>> the
>> >> build version....
>> >> - I would like to know if is there a way to obtain the project
>> version
>> >> from
>> >> the java code in a way that I'm able to insert a label showing that
>> >> version...
>> >> - If there wasn't such a way, I was thinking to write project version
>> in
>> >> a
>> >> file, then from java code I would read that file and would update my
>> >> label...
>> >>
>> >> Have you got any idea? Obviously I would like to take advantage of
>> Maven
>> >> and
>> >> I would prefer to avoid another file....
>> >>
>> >> Thanks in advance,
>> >> Raffaele Gambelli
>> >> --
>> >> View this message in context:
>> >> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Project-versioning-tp20601486p20603012.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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20605912.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: Project versioning

Posted by Stephen Connolly <st...@gmail.com>.
I always rejig my resources folders so that I have

src/main/resources/filtered
src/main/resources/verbatim
src/test/resources/filtered
src/test/resources/verbatim

If only I could come up with a good version for webapps

2008/11/20 Brian E. Fox <br...@reply.infinity.nu>

> No you can't filter only one file that I recall, but you can make
> something like src/main/filtered-resources and enable filtering on that
> folder only.
>
> -----Original Message-----
> From: Raffaele [mailto:r.gambelli@prismasw.it]
> Sent: Thursday, November 20, 2008 10:00 AM
> To: users@maven.apache.org
> Subject: Re: Project versioning
>
>
> Ok guys thank you all,
>
> There is only one thing that I'm continuing to not understand....
> In my src/main/resources I have many many files.....
> I would like to filter only one of those files....
> but putting this in my pom
>
> <resources>
>        <resource>
>                <directory>src/main/resources</directory>
>               <filtering>true</filtering>
>        </resource>
> </resources>
>
> has effect to try to filter all the files....
> How could I say maven to filter only one specific file and not a full
> folder?
>
> Best regards
> Raffaele
>
>
> Stephen Connolly-2 wrote:
> >
> > Alternatively, you could pull the version info from the pom.xml that
> gets
> > stashed in a sub-folder of META-INF by default.... but this might
> require
> > a
> > bit of work since the version could have been inherited from the
> parent
> > version...
> >
> > Safest way is as Brian suggests... and it has the added advantage of
> not
> > tieing you to maven for your build.
> >
> > What we do is we have a properties file with
> >
> > version=${project.version}
> >
> > as the only entry.  We then turn on filtering for that properties
> file,
> > and
> > to access it from code we just use getClass().getResource("/path to
> > versions.properties")
> >
> > 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> >
> >> Normally you just have a properties file that is filtered during the
> >> build and at runtime your code reads the value.
> >>
> >> -----Original Message-----
> >> From: Raffaele [mailto:r.gambelli@prismasw.it]
> >> Sent: Thursday, November 20, 2008 8:53 AM
> >> To: users@maven.apache.org
> >> Subject: Project versioning
> >>
> >>
> >> Hi all,
> >>
> >> I would like some advices about how automatically update a properties
> >> file
> >> inserting into an incremental value representing the build number....
> >>
> >> My scenario:
> >> - I have a web application and I would like to insert in some page,
> the
> >> build version....
> >> - I would like to know if is there a way to obtain the project
> version
> >> from
> >> the java code in a way that I'm able to insert a label showing that
> >> version...
> >> - If there wasn't such a way, I was thinking to write project version
> in
> >> a
> >> file, then from java code I would read that file and would update my
> >> label...
> >>
> >> Have you got any idea? Obviously I would like to take advantage of
> Maven
> >> and
> >> I would prefer to avoid another file....
> >>
> >> Thanks in advance,
> >> Raffaele Gambelli
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
> >>
> >>
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Project-versioning-tp20601486p20603012.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: Project versioning

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
No you can't filter only one file that I recall, but you can make
something like src/main/filtered-resources and enable filtering on that
folder only.

-----Original Message-----
From: Raffaele [mailto:r.gambelli@prismasw.it] 
Sent: Thursday, November 20, 2008 10:00 AM
To: users@maven.apache.org
Subject: Re: Project versioning


Ok guys thank you all,

There is only one thing that I'm continuing to not understand....
In my src/main/resources I have many many files.....
I would like to filter only one of those files....
but putting this in my pom

<resources>
      	<resource>
        	<directory>src/main/resources</directory>
               <filtering>true</filtering>        			
	</resource>
</resources>

has effect to try to filter all the files....
How could I say maven to filter only one specific file and not a full
folder?

Best regards
Raffaele


Stephen Connolly-2 wrote:
> 
> Alternatively, you could pull the version info from the pom.xml that
gets
> stashed in a sub-folder of META-INF by default.... but this might
require
> a
> bit of work since the version could have been inherited from the
parent
> version...
> 
> Safest way is as Brian suggests... and it has the added advantage of
not
> tieing you to maven for your build.
> 
> What we do is we have a properties file with
> 
> version=${project.version}
> 
> as the only entry.  We then turn on filtering for that properties
file,
> and
> to access it from code we just use getClass().getResource("/path to
> versions.properties")
> 
> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> 
>> Normally you just have a properties file that is filtered during the
>> build and at runtime your code reads the value.
>>
>> -----Original Message-----
>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>> Sent: Thursday, November 20, 2008 8:53 AM
>> To: users@maven.apache.org
>> Subject: Project versioning
>>
>>
>> Hi all,
>>
>> I would like some advices about how automatically update a properties
>> file
>> inserting into an incremental value representing the build number....
>>
>> My scenario:
>> - I have a web application and I would like to insert in some page,
the
>> build version....
>> - I would like to know if is there a way to obtain the project
version
>> from
>> the java code in a way that I'm able to insert a label showing that
>> version...
>> - If there wasn't such a way, I was thinking to write project version
in
>> a
>> file, then from java code I would read that file and would update my
>> label...
>>
>> Have you got any idea? Obviously I would like to take advantage of
Maven
>> and
>> I would prefer to avoid another file....
>>
>> Thanks in advance,
>> Raffaele Gambelli
>> --
>> View this message in context:
>> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
>>
>>
> 
> 

-- 
View this message in context:
http://www.nabble.com/Project-versioning-tp20601486p20603012.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: Project versioning

Posted by Raffaele <r....@prismasw.it>.
Ok guys thank you all,

There is only one thing that I'm continuing to not understand....
In my src/main/resources I have many many files.....
I would like to filter only one of those files....
but putting this in my pom

<resources>
      	<resource>
        	<directory>src/main/resources</directory>
               <filtering>true</filtering>        			
	</resource>
</resources>

has effect to try to filter all the files....
How could I say maven to filter only one specific file and not a full
folder?

Best regards
Raffaele


Stephen Connolly-2 wrote:
> 
> Alternatively, you could pull the version info from the pom.xml that gets
> stashed in a sub-folder of META-INF by default.... but this might require
> a
> bit of work since the version could have been inherited from the parent
> version...
> 
> Safest way is as Brian suggests... and it has the added advantage of not
> tieing you to maven for your build.
> 
> What we do is we have a properties file with
> 
> version=${project.version}
> 
> as the only entry.  We then turn on filtering for that properties file,
> and
> to access it from code we just use getClass().getResource("/path to
> versions.properties")
> 
> 2008/11/20 Brian E. Fox <br...@reply.infinity.nu>
> 
>> Normally you just have a properties file that is filtered during the
>> build and at runtime your code reads the value.
>>
>> -----Original Message-----
>> From: Raffaele [mailto:r.gambelli@prismasw.it]
>> Sent: Thursday, November 20, 2008 8:53 AM
>> To: users@maven.apache.org
>> Subject: Project versioning
>>
>>
>> Hi all,
>>
>> I would like some advices about how automatically update a properties
>> file
>> inserting into an incremental value representing the build number....
>>
>> My scenario:
>> - I have a web application and I would like to insert in some page, the
>> build version....
>> - I would like to know if is there a way to obtain the project version
>> from
>> the java code in a way that I'm able to insert a label showing that
>> version...
>> - If there wasn't such a way, I was thinking to write project version in
>> a
>> file, then from java code I would read that file and would update my
>> label...
>>
>> Have you got any idea? Obviously I would like to take advantage of Maven
>> and
>> I would prefer to avoid another file....
>>
>> Thanks in advance,
>> Raffaele Gambelli
>> --
>> View this message in context:
>> http://www.nabble.com/Project-versioning-tp20601486p20601486.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
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Project-versioning-tp20601486p20603012.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: Project versioning

Posted by Stephen Connolly <st...@gmail.com>.
Alternatively, you could pull the version info from the pom.xml that gets
stashed in a sub-folder of META-INF by default.... but this might require a
bit of work since the version could have been inherited from the parent
version...

Safest way is as Brian suggests... and it has the added advantage of not
tieing you to maven for your build.

What we do is we have a properties file with

version=${project.version}

as the only entry.  We then turn on filtering for that properties file, and
to access it from code we just use getClass().getResource("/path to
versions.properties")

2008/11/20 Brian E. Fox <br...@reply.infinity.nu>

> Normally you just have a properties file that is filtered during the
> build and at runtime your code reads the value.
>
> -----Original Message-----
> From: Raffaele [mailto:r.gambelli@prismasw.it]
> Sent: Thursday, November 20, 2008 8:53 AM
> To: users@maven.apache.org
> Subject: Project versioning
>
>
> Hi all,
>
> I would like some advices about how automatically update a properties
> file
> inserting into an incremental value representing the build number....
>
> My scenario:
> - I have a web application and I would like to insert in some page, the
> build version....
> - I would like to know if is there a way to obtain the project version
> from
> the java code in a way that I'm able to insert a label showing that
> version...
> - If there wasn't such a way, I was thinking to write project version in
> a
> file, then from java code I would read that file and would update my
> label...
>
> Have you got any idea? Obviously I would like to take advantage of Maven
> and
> I would prefer to avoid another file....
>
> Thanks in advance,
> Raffaele Gambelli
> --
> View this message in context:
> http://www.nabble.com/Project-versioning-tp20601486p20601486.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: Project versioning

Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
Normally you just have a properties file that is filtered during the
build and at runtime your code reads the value.

-----Original Message-----
From: Raffaele [mailto:r.gambelli@prismasw.it] 
Sent: Thursday, November 20, 2008 8:53 AM
To: users@maven.apache.org
Subject: Project versioning


Hi all,

I would like some advices about how automatically update a properties
file
inserting into an incremental value representing the build number....

My scenario:
- I have a web application and I would like to insert in some page, the
build version....
- I would like to know if is there a way to obtain the project version
from
the java code in a way that I'm able to insert a label showing that
version...
- If there wasn't such a way, I was thinking to write project version in
a
file, then from java code I would read that file and would update my
label...

Have you got any idea? Obviously I would like to take advantage of Maven
and
I would prefer to avoid another file....

Thanks in advance,
Raffaele Gambelli
-- 
View this message in context:
http://www.nabble.com/Project-versioning-tp20601486p20601486.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