You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "Tawfik, Sameh E" <Sa...@fairisaac.com> on 2008/04/16 23:49:48 UTC

What is the syntax to retrieve a system property value form a pom?

Hi,

What is the syntax to use from inside a pom.xml file to retrieve the
value of the system date on Windows XP?

I need to update the following parameter with the Build-date value. I
tried ${env.date} but it did not work?

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Built-By>xyz, Inc.</Built-By>
                            <Build-date>?????</Build-date>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>

 Thanks,

  Sameh
This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


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


Re: What is the syntax to retrieve a system property value form a pom?

Posted by Wayne Fay <wa...@gmail.com>.
No such property exists, unless you've added the buildnumber plugin to
your build:
http://mojo.codehaus.org/buildnumber-maven-plugin/

Wayne

On 4/16/08, Tawfik, Sameh E <Sa...@fairisaac.com> wrote:
>
> Hi,
>
> What is the syntax to use from inside a pom.xml file to retrieve the
> value of the system date on Windows XP?
>
> I need to update the following parameter with the Build-date value. I
> tried ${env.date} but it did not work?
>
>            <plugin>
>                <groupId>org.apache.maven.plugins</groupId>
>                <artifactId>maven-jar-plugin</artifactId>
>                <configuration>
>                    <archive>
>                        <manifestEntries>
>                            <Built-By>xyz, Inc.</Built-By>
>                            <Build-date>?????</Build-date>
>                        </manifestEntries>
>                    </archive>
>                </configuration>
>            </plugin>
>
>  Thanks,
>
>  Sameh
> This email and any files transmitted with it are confidential, proprietary
> and intended solely for the individual or entity to whom they are addressed.
> If you have received this email in error please delete it immediately.
>
>
> ---------------------------------------------------------------------
> 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: What is the syntax to retrieve a system property value form a pom?

Posted by "Tawfik, Sameh E" <Sa...@fairisaac.com>.
Thanks Wendy, this approach worked, but I'd to use the buildNumber
property and not the timestamp as I thought I would?

I must be using the wrong format, but I tried few choices and nothing
worked. The time stamp always appears as follow:

[INFO] Storing buildNumber: Apr 16, 2008 at timestamp: 1208394330099


Anyway, here is the code I'm using which is accomplishing what I need:


           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>buildnumber-maven-plugin</artifactId>
             <executions>
               <execution>
                 <phase>validate</phase>        
                 <goals>
                   <goal>create</goal>
                 </goals>
               </execution>
             </executions>
             <configuration>
               <doCheck>false</doCheck>
               <doUpdate>false</doUpdate>

               <format>{0,date}</format>
               <items>
                 <item>timestamp</item>
               </items>

             </configuration>
           </plugin>



            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestEntries>
                            <Built-By>xyz, Inc.</Built-By>
                            <Build-date>${buildNumber}</Build-date>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>


-----Original Message-----
From: Wendy Smoak [mailto:wsmoak@gmail.com] 
Sent: Wednesday, April 16, 2008 3:29 PM
To: Maven Users List
Subject: Re: What is the syntax to retrieve a system property value form
a pom?

On Wed, Apr 16, 2008 at 2:49 PM, Tawfik, Sameh E
<Sa...@fairisaac.com> wrote:

>  I need to update the following parameter with the Build-date value. I
>  tried ${env.date} but it did not work?

You can use the Build Number plugin to put the current date into a
property that you can use in the build:

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

-- 
Wendy

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

This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.


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


Re: What is the syntax to retrieve a system property value form a pom?

Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Apr 16, 2008 at 2:49 PM, Tawfik, Sameh E
<Sa...@fairisaac.com> wrote:

>  I need to update the following parameter with the Build-date value. I
>  tried ${env.date} but it did not work?

You can use the Build Number plugin to put the current date into a
property that you can use in the build:

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

-- 
Wendy

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