You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Rex Huang <re...@gmail.com> on 2008/01/18 15:28:14 UTC

how can I to use build time in pom files

Does maven has build time property, which I can use in pom files
<my-property>${build time}<my-property>

BR//Rex

Re: how can I to use build time in pom files

Posted by amit kumar <am...@gmail.com>.
You can use buildnumber-maven-plugin, for this but i was able to have
date+time... tried only time format but it wasn't running. If this solves
your purpose lemme know, I will share the relevant portion of my pom.

On Jan 18, 2008 7:58 PM, Rex Huang <re...@gmail.com> wrote:

> Does maven has build time property, which I can use in pom files
> <my-property>${build time}<my-property>
>
> BR//Rex
>

Re: how can I to use build time in pom files

Posted by Rex Huang <re...@gmail.com>.
yes, this is work, but I don't know why it can't transfer this value via
properties.

Rex

On Jan 21, 2008 7:17 PM, Mick Knutson <mi...@gmail.com> wrote:

> actually, why can't you just add ${buildNumber} to your Versions.txt ???
>
>
> On Jan 21, 2008 10:17 AM, Mick Knutson <mi...@gmail.com> wrote:
>
> > Add this to your filter.properties:
> >
> > BUILDTIME=${buildNumber}
> >
> >
> >
> > On Jan 21, 2008 9:10 AM, Rex Huang <re...@gmail.com> wrote:
> >
> > > yah, use buildnumber-maven-plugin may be better.
> > > one strange thing is I can't use ${buildNumber} in filter,
> > > when I want to replace $BUILDTIME in the resource file.
> > > such as:
> > > in pom.xml
> > >    <properties>
> > >        <BUILDTIME>${buildNumber}</BUILDTIME>
> > >    </properties>
> > >
> > >      <resource>
> > >        <directory>src/main/resources</directory>
> > >        <filtering>true</filtering>
> > >        <includes>
> > >            <include>Version.txt</include>
> > >        </includes>
> > >      </resource>
> > >
> > > in Version.txt
> > > build-time= ${BUILDTIME}
> > >
> >
> >
> >
> > --
> > Thanks,
> > Mick Knutson
> >
> > http://www.baselogic.com
> > http://www.blincmagazine.com
> > http://www.djmick.com
> > http://www.myspace.com/mickknutson
> > http://www.myspace.com/BLiNCMagazine
> > http://tahoe.baselogic.com
> > ---
>
>
>
>
> --
> Thanks,
> Mick Knutson
>
> http://www.baselogic.com
> http://www.blincmagazine.com
> http://www.djmick.com
> http://www.myspace.com/mickknutson
> http://www.myspace.com/BLiNCMagazine
> http://tahoe.baselogic.com
> ---
>

Re: how can I to use build time in pom files

Posted by Mick Knutson <mi...@gmail.com>.
actually, why can't you just add ${buildNumber} to your Versions.txt ???


On Jan 21, 2008 10:17 AM, Mick Knutson <mi...@gmail.com> wrote:

> Add this to your filter.properties:
>
> BUILDTIME=${buildNumber}
>
>
>
> On Jan 21, 2008 9:10 AM, Rex Huang <re...@gmail.com> wrote:
>
> > yah, use buildnumber-maven-plugin may be better.
> > one strange thing is I can't use ${buildNumber} in filter,
> > when I want to replace $BUILDTIME in the resource file.
> > such as:
> > in pom.xml
> >    <properties>
> >        <BUILDTIME>${buildNumber}</BUILDTIME>
> >    </properties>
> >
> >      <resource>
> >        <directory>src/main/resources</directory>
> >        <filtering>true</filtering>
> >        <includes>
> >            <include>Version.txt</include>
> >        </includes>
> >      </resource>
> >
> > in Version.txt
> > build-time= ${BUILDTIME}
> >
>
>
>
> --
> Thanks,
> Mick Knutson
>
> http://www.baselogic.com
> http://www.blincmagazine.com
> http://www.djmick.com
> http://www.myspace.com/mickknutson
> http://www.myspace.com/BLiNCMagazine
> http://tahoe.baselogic.com
> ---




-- 
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---

Re: how can I to use build time in pom files

Posted by Mick Knutson <mi...@gmail.com>.
Add this to your filter.properties:

BUILDTIME=${buildNumber}


On Jan 21, 2008 9:10 AM, Rex Huang <re...@gmail.com> wrote:

> yah, use buildnumber-maven-plugin may be better.
> one strange thing is I can't use ${buildNumber} in filter,
> when I want to replace $BUILDTIME in the resource file.
> such as:
> in pom.xml
>    <properties>
>        <BUILDTIME>${buildNumber}</BUILDTIME>
>    </properties>
>
>      <resource>
>        <directory>src/main/resources</directory>
>        <filtering>true</filtering>
>        <includes>
>            <include>Version.txt</include>
>        </includes>
>      </resource>
>
> in Version.txt
> build-time= ${BUILDTIME}
>



-- 
Thanks,
Mick Knutson

http://www.baselogic.com
http://www.blincmagazine.com
http://www.djmick.com
http://www.myspace.com/mickknutson
http://www.myspace.com/BLiNCMagazine
http://tahoe.baselogic.com
---

Re: how can I to use build time in pom files

Posted by Rex Huang <re...@gmail.com>.
yah, use buildnumber-maven-plugin may be better.
one strange thing is I can't use ${buildNumber} in filter,
when I want to replace $BUILDTIME in the resource file.
such as:
in pom.xml
    <properties>
        <BUILDTIME>${buildNumber}</BUILDTIME>
    </properties>

      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
            <include>Version.txt</include>
        </includes>
      </resource>

in Version.txt
build-time= ${BUILDTIME}

Re: how can I to use build time in pom files

Posted by Mick Knutson <mi...@gmail.com>.
            <!-- =======================================================-->
            <!-- Build Number Plugin -->
            <!-- =======================================================-->
            <!--
                This mojo is designed to get a unique build number for each
                time you build your project. So while your version may
remain
                constant at 1.0-SNAPSHOT for many iterations until release,
you
                will have a build number that can uniquely identify each
build
                during that time. The build number is obtained from scm, and
in
                particular, at this time, from svn. You can then place that
                build number in metadata, which can be accessed from your
app,
                if desired.

                The mojo also has a couple of extra functions to ensure you
get
                the proper build number. First, your local repository is
                checked to make sure it is up to date. Second, your local
                repository is automatically updated, so that you get the
latest
                build number. Both these functions can be suppressed, if
desired.

                Optionally, you can configure this mojo to produce a
revision
                based on a timestamp, or on a sequence, without requiring
any
                interaction with an SCM system. Note that currently, the
only
                supported SCM is subversion.

                http://mojo.codehaus.org/buildnumber-maven-plugin/
            -->
            <!-- =======================================================-->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.0-beta-1-SNAPSHOT</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
                    <items>
                        <item>timestamp</item>
                    </items>
                </configuration>
            </plugin>

RE: how can I to use build time in pom files

Posted by ni...@planet.nl.
The newer version of this plugin is found here:

http://mojo.codehaus.org/buildnumber-maven-plugin/

And the artifacts can also be found on central:

http://mvnrepository.com/artifact/org.codehaus.mojo/buildnumber-maven-plugin

Hth,

Nick Stolwijk


-----Original Message-----
From: Rex Huang [mailto:rex.huang936@gmail.com]
Sent: Mon 1/21/2008 5:02 PM
To: Maven Users List
Subject: Re: how can I to use build time in pom files
 
I found information of maven-buildnumber-plugin here:
http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html
it's works!

Rex

On Jan 18, 2008 3:33 PM, Mark Eramo <ma...@trustvesta.com> wrote:

> Rex,
>   Have a look at the Maven build number plugin. It may be able to do
> what you need.
>
> *http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html*
>
> Regards,
> Mark
>
>
> Rex Huang wrote:
> > Does maven has build time property, which I can use in pom files
> > <my-property>${build time}<my-property>
> >
> > BR//Rex
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


Re: how can I to use build time in pom files

Posted by Rex Huang <re...@gmail.com>.
I found information of maven-buildnumber-plugin here:
http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html
it's works!

Rex

On Jan 18, 2008 3:33 PM, Mark Eramo <ma...@trustvesta.com> wrote:

> Rex,
>   Have a look at the Maven build number plugin. It may be able to do
> what you need.
>
> *http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html*
>
> Regards,
> Mark
>
>
> Rex Huang wrote:
> > Does maven has build time property, which I can use in pom files
> > <my-property>${build time}<my-property>
> >
> > BR//Rex
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

Re: how can I to use build time in pom files

Posted by Mark Eramo <ma...@trustvesta.com>.
Rex,
   Have a look at the Maven build number plugin. It may be able to do 
what you need.

*http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html*

Regards,
Mark


Rex Huang wrote:
> Does maven has build time property, which I can use in pom files
> <my-property>${build time}<my-property>
>
> BR//Rex
>
>   

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