I suspect the question you are asking is:

Is there any way to know what the timestamp is that has been used in
place of the -SNAPSHOT?

i.e. you need to know if this is "1.0-20081002.110956"

The answer is that this value is only determined at the time that the
artifact is deployed... at which point it is too late to modify the
artifact so that it contains the -SNAPSHOT value... plus that would
have a side effect of modifying the artifact that goes into your
remote repository and you would then have different artifacts in your
local and remote repository. (which is a very bad thing)

Otherwise, if you are happy to know that the version is "1.0-SNAPSHOT"
and not "0.9-SNAPSHOT" or "1.0" then resource filtering is probably
the way to go... or better yet add the version to either the
specification-version or implementation-version attibutes in the
manifest of your jar that way you can pull the version of the class by
something like:

foo.getClass().getPackage().getManifest???().getImplementationVersion???()

2008/10/2 Magne Nordtveit <[EMAIL PROTECTED]>:
> On Wednesday 24 September 2008 18:42:27 mateamargo wrote:
>> I have setted the version to 1.0-SNAPSHOT, but I need to know what's the
>> current value. Is there a way to know that using any Maven API? or maybe
>> generating a file after compiling?
>>
>> Thanks.
>
> What you can do, is to perform resource filtering on a text file you package
> into the jar, and then read this when querrying for the version. This is what
> we do for a number of our software, and it works like a charm. (Check [1] if
> you are unsure about what i mean)
>
> If you want to include buildnumber, i think there is a build number generating
> maven plugin you can use. I think i have seen something like that earlier.
>
> Magne
>
> [1] - http://maven.apache.org/plugins/maven-resources-plugin/
> --
> Magne Nordtveit <[EMAIL PROTECTED]>
> Systems Engineer
> Offshore Simulator Centre AS
> http://www.offsimcentre.no
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to