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 <[EMAIL PROTECTED]>

> 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:[EMAIL PROTECTED]
> 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: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to