You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Frank Russo <fr...@FXALL.com> on 2006/07/07 21:57:47 UTC

Accessing the build number

Is there a way to configure the deploy plug in from the pom, so that a
snapshot's build number can be accessed and be accessed later by doing
something like ${buildNumber}? 
 

Frank Russo
Senior Developer
FX Alliance, LLC


Re: Accessing the build number

Posted by Lukasz Szelag <ls...@accoona.com>.
Pete,

Unfortunately, the sourcecode belongs to my employer so I won't be able to
send it to you :( However, the Mojo is really simple. What you need to do is
to define a member variable of type Artifact (see my previous post) and then
you can access the version, etc. by invoking some methods on that object.
Mojo is a regular Java class which conforms to some conventions (there are
many tutorials on how to write a Mojo - check Maven Website). You don't need
to worry about the descriptor as it will be generated automatically. As far
as accessing the version from a property file check my previous post - you
"may" be able to do it via ${project.artifact.version}.

Lukasz

-- 
View this message in context: http://www.nabble.com/Accessing-the-build-number-tf1908562.html#a5378046
Sent from the Maven - Users forum at Nabble.com.


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


Re: Accessing the build number

Posted by Pete <pe...@gmail.com>.
Hi Luasz,

1) Is there any chance you could send me your mojo source code and
descriptor files, I am quite new to MOJOs.

2) Using you MOJO how would you then access this value. I am trying to
think of a way of accessing the build timestamp in a
filter.properties file  e.g.

filter.properties

${build.timestamp}

Pete



On 17/07/06, Lukasz Szelag <ls...@accoona.com> wrote:
>
> I had a similar problem (trying to access the artifact timestamp, which
> includes the build number). The following is from my Mojo:
>
>         /**
>          * The project artifact.
>          *
>          * @parameter expression="${project.artifact}"
>      * @required
>      * @readonly
>          */
>         private Artifact artifact;
>
>
> and then artifact.getVersion(). Perhaps you can do it also from POM via
> ${project.artifact.version}.
>
> --
> View this message in context: http://www.nabble.com/Accessing-the-build-number-tf1908562.html#a5361395
> Sent from the Maven - Users forum 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: Accessing the build number

Posted by Lukasz Szelag <ls...@accoona.com>.
I had a similar problem (trying to access the artifact timestamp, which
includes the build number). The following is from my Mojo:

	/**
	 * The project artifact.
	 * 
	 * @parameter expression="${project.artifact}"
     * @required
     * @readonly
	 */
	private Artifact artifact;


and then artifact.getVersion(). Perhaps you can do it also from POM via
${project.artifact.version}.

-- 
View this message in context: http://www.nabble.com/Accessing-the-build-number-tf1908562.html#a5361395
Sent from the Maven - Users forum at Nabble.com.


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