You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by ra...@jpmchase.com on 2006/05/30 22:03:17 UTC

date in manifest

Hi  All

If i want to make entry of build date to mani-fest files how do i do that?

i know how to make entry to mani-fest but don't know what maven variable 
has the value for date ??

Anyone knows  it , please advise?





Thanks,
Raghu 

Re: date in manifest

Posted by Kieran Brady <ki...@teamcgi.net>.
Thanks, I'll give it another try Julian.

The workaround is holding together though and has proven pretty reliable in 
terms of getting ant properties into the filtering phase :)

----- Original Message ----- 
From: "Julian Wood" <wo...@ucalgary.ca>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Wednesday, May 31, 2006 5:34 PM
Subject: Re: date in manifest


> It works fine for me. Did you configure it to use a timestamp rather  than 
> scm? It won't check scm at all if configured like that. Try this:
>
> 1. mvn archetype:create -DgroupId=ca.ucalgary.commons -DartifactId=test
> 2. Add this to your pom:
>
>   <repositories>
>     <repository>
>        <id>tlc-snapshots</id>
>        <name>TLC Snapshot Development Repository</name>
>         <url>http://commons.ucalgary.ca/pub/m2-snapshots</url>
>     </repository>
>    </repositories>
>    <pluginRepositories>
>      <pluginRepository>
>        <id>tlc-snapshots</id>
>        <name>TLC Snapshot Development Repository</name>
>        <url>http://commons.ucalgary.ca/pub/m2-snapshots</url>
>      </pluginRepository>
>    </pluginRepositories>
>    <build>
>     <plugins>
>       <plugin>
>         <groupId>org.codehaus.mojo</groupId>
>         <artifactId>maven-buildnumber-plugin</artifactId>
>         <version>0.9.2-SNAPSHOT</version>
>         <configuration>
>           <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
>           <items>
>             <item>timestamp</item>
>           </items>
>         </configuration>
>       </plugin>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-jar-plugin</artifactId>
>         <configuration>
>           <archive>
>             <manifestEntries>
>               <Implementation-Build>${buildNumber}</Implementation- Build>
>             </manifestEntries>
>           </archive>
>         </configuration>
>       </plugin>
>     </plugins>
>   </build>
>
> 3. mvn buildnumber:create package
> 4. Check out the Implementation-Build property in META-INF/ MANIFEST.MF 
> inside of test-1.0-SNAPSHOT.jar
>
> J
>
>
> On 31-May-06, at 1:17 AM, Kieran Brady wrote:
>
>> I tried te build number plugins without any success as it didn't  seem 
>> happy to create a timestamp independently of SCM? I'm using  CVS and it 
>> wasn't happy with it..
>>
>> Instead I have this horrible hack! Our Maven setup seems to be an  ever 
>> expanding collection of horrible hacks :-/
>>
>> [...]
>> <plugin>
>>    <artifactId>maven-antrun-plugin</artifactId>
>>    <executions>
>>        <execution>
>>            <id>create-timestamp-file</id>
>>            <phase>generate-resources</phase>
>>            <goals>
>>                <goal>run</goal>
>>            </goals>
>>            <configuration>
>>                <tasks>
>>                    <tstamp>
>>                        <format property="time" pattern="dd.MM.yyyy- 
>> HH.mm" locale="en" />
>>                    </tstamp>
>>                    <property name="timestamp" value="${time}-$ 
>> {user.name}" />
>>                    <touch file=".build.timestamp.properties" />
>>                    <echo file=".build.timestamp.properties" 
>> append="false" message="timestamp=${timestamp}" />
>>                </tasks>
>>            </configuration>
>>        </execution>
>>        <execution>
>>            <id>delete-timestamp-file</id>
>>            <phase>clean</phase>
>>            <goals>
>>                <goal>run</goal>
>>            </goals>
>>            <configuration>
>>                <tasks>
>>                    <delete file=".build.timestamp.properties" />
>>                </tasks>
>>            </configuration>
>>        </execution>
>>    </executions>
>> </plugin>
>> [...]
>>
>> and
>>
>> [...]
>>
>> <filters>
>>    [...]
>>    <filter>.build.timestamp.properties</filter>
>> </filters>
>>
>>
>> ----- Original Message ----- From: "Julian Wood" <wo...@ucalgary.ca>
>> To: "Maven Users List" <us...@maven.apache.org>
>> Sent: Tuesday, May 30, 2006 10:43 PM
>> Subject: Re: date in manifest
>>
>>
>>> You can use the maven-buildNumber-plugin.
>>>
>>> http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/ howto.html
>>>
>>> Near the bottom it tells you how to use a timestamp.
>>>
>>> There was some talk of making the build date a more globally   available 
>>> property (negating the need for this plugin), but I  don't  know what it 
>>> is, or if it was done.
>>>
>>> J
>>>
>>> On 30-May-06, at 2:03 PM, raghurajan.x.gurunathan@jpmchase.com wrote:
>>>
>>>> Hi  All
>>>>
>>>> If i want to make entry of build date to mani-fest files how do  i  do 
>>>> that?
>>>>
>>>> i know how to make entry to mani-fest but don't know what maven 
>>>> variable
>>>> has the value for date ??
>>>>
>>>> Anyone knows  it , please advise?
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> Thanks,
>>>> Raghu
>>>
>>> --
>>> Julian Wood <wo...@ucalgary.ca>
>>>
>>> Software Engineer
>>> Teaching & Learning Centre
>>> University of Calgary
>>>
>>> http://tlc.ucalgary.ca
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
> --
> Julian Wood <wo...@ucalgary.ca>
>
> Software Engineer
> Teaching & Learning Centre
> University of Calgary
>
> http://tlc.ucalgary.ca
>
>
>
> ---------------------------------------------------------------------
> 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: date in manifest

Posted by Julian Wood <wo...@ucalgary.ca>.
It works fine for me. Did you configure it to use a timestamp rather  
than scm? It won't check scm at all if configured like that. Try this:

1. mvn archetype:create -DgroupId=ca.ucalgary.commons -DartifactId=test
2. Add this to your pom:

   <repositories>
     <repository>
        <id>tlc-snapshots</id>
        <name>TLC Snapshot Development Repository</name>
         <url>http://commons.ucalgary.ca/pub/m2-snapshots</url>
     </repository>
    </repositories>
    <pluginRepositories>
      <pluginRepository>
        <id>tlc-snapshots</id>
        <name>TLC Snapshot Development Repository</name>
        <url>http://commons.ucalgary.ca/pub/m2-snapshots</url>
      </pluginRepository>
    </pluginRepositories>
    <build>
     <plugins>
       <plugin>
         <groupId>org.codehaus.mojo</groupId>
         <artifactId>maven-buildnumber-plugin</artifactId>
         <version>0.9.2-SNAPSHOT</version>
         <configuration>
           <format>{0,date,yyyy-MM-dd HH:mm:ss}</format>
           <items>
             <item>timestamp</item>
           </items>
         </configuration>
       </plugin>
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-jar-plugin</artifactId>
         <configuration>
           <archive>
             <manifestEntries>
               <Implementation-Build>${buildNumber}</Implementation- 
Build>
             </manifestEntries>
           </archive>
         </configuration>
       </plugin>
     </plugins>
   </build>

3. mvn buildnumber:create package
4. Check out the Implementation-Build property in META-INF/ 
MANIFEST.MF inside of test-1.0-SNAPSHOT.jar

J


On 31-May-06, at 1:17 AM, Kieran Brady wrote:

> I tried te build number plugins without any success as it didn't  
> seem happy to create a timestamp independently of SCM? I'm using  
> CVS and it wasn't happy with it..
>
> Instead I have this horrible hack! Our Maven setup seems to be an  
> ever expanding collection of horrible hacks :-/
>
> [...]
> <plugin>
>    <artifactId>maven-antrun-plugin</artifactId>
>    <executions>
>        <execution>
>            <id>create-timestamp-file</id>
>            <phase>generate-resources</phase>
>            <goals>
>                <goal>run</goal>
>            </goals>
>            <configuration>
>                <tasks>
>                    <tstamp>
>                        <format property="time" pattern="dd.MM.yyyy- 
> HH.mm" locale="en" />
>                    </tstamp>
>                    <property name="timestamp" value="${time}-$ 
> {user.name}" />
>                    <touch file=".build.timestamp.properties" />
>                    <echo file=".build.timestamp.properties"  
> append="false" message="timestamp=${timestamp}" />
>                </tasks>
>            </configuration>
>        </execution>
>        <execution>
>            <id>delete-timestamp-file</id>
>            <phase>clean</phase>
>            <goals>
>                <goal>run</goal>
>            </goals>
>            <configuration>
>                <tasks>
>                    <delete file=".build.timestamp.properties" />
>                </tasks>
>            </configuration>
>        </execution>
>    </executions>
> </plugin>
> [...]
>
> and
>
> [...]
>
> <filters>
>    [...]
>    <filter>.build.timestamp.properties</filter>
> </filters>
>
>
> ----- Original Message ----- From: "Julian Wood" <wo...@ucalgary.ca>
> To: "Maven Users List" <us...@maven.apache.org>
> Sent: Tuesday, May 30, 2006 10:43 PM
> Subject: Re: date in manifest
>
>
>> You can use the maven-buildNumber-plugin.
>>
>> http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/ 
>> howto.html
>>
>> Near the bottom it tells you how to use a timestamp.
>>
>> There was some talk of making the build date a more globally   
>> available property (negating the need for this plugin), but I  
>> don't  know what it is, or if it was done.
>>
>> J
>>
>> On 30-May-06, at 2:03 PM, raghurajan.x.gurunathan@jpmchase.com wrote:
>>
>>> Hi  All
>>>
>>> If i want to make entry of build date to mani-fest files how do  
>>> i  do that?
>>>
>>> i know how to make entry to mani-fest but don't know what maven   
>>> variable
>>> has the value for date ??
>>>
>>> Anyone knows  it , please advise?
>>>
>>>
>>>
>>>
>>>
>>> Thanks,
>>> Raghu
>>
>> --
>> Julian Wood <wo...@ucalgary.ca>
>>
>> Software Engineer
>> Teaching & Learning Centre
>> University of Calgary
>>
>> http://tlc.ucalgary.ca
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>

--
Julian Wood <wo...@ucalgary.ca>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca



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


Re: date in manifest

Posted by Julian Wood <wo...@ucalgary.ca>.
I think this note from Thierry was meant for Kieran, but yes, that's  
how maven-buildnumber-plugin (or anything else) can place things in  
your jar or war file.

J

On 31-May-06, at 3:49 AM, Thierry Barnier wrote:

> Hi Julian,
>
> have you tried this stuff (look @ the <manifestEntry> section)
>
> More info on http://maven.apache.org/guides/mini/guide-manifest.html
>
>
> Thierry
>

--
Julian Wood <wo...@ucalgary.ca>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca



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


Re: date in manifest

Posted by Thierry Barnier <tb...@gmail.com>.
Hi Julian,

have you tried this stuff (look @ the <manifestEntry> section)

More info on http://maven.apache.org/guides/mini/guide-manifest.html


Thierry

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
            <!--
            <index>true</true>
            -->
            <manifest>
              <mainClass>com.mycompany.app.App</mainClass>
              <packageName>com.mycompany.app</packageName>
              <!-- options
              <manifestFile>/path/to/MANIFEST.MF</manifestFile>
              <addClasspath>true</addClasspath>
              <addExtensions/>
              <classpathPrefix/>
              -->
            </manifest>
            <manifestEntries>
              <mode>development</mode>
              <url>${pom.url}</url>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
    </plugins>
  </build>
  ...
</project>



2006/5/31, Kieran Brady <ki...@teamcgi.net>:
>
> I tried te build number plugins without any success as it didn't seem
> happy
> to create a timestamp independently of SCM? I'm using CVS and it wasn't
> happy with it..
>
> Instead I have this horrible hack! Our Maven setup seems to be an ever
> expanding collection of horrible hacks :-/
>
> [...]
> <plugin>
>     <artifactId>maven-antrun-plugin</artifactId>
>     <executions>
>         <execution>
>             <id>create-timestamp-file</id>
>             <phase>generate-resources</phase>
>             <goals>
>                 <goal>run</goal>
>             </goals>
>             <configuration>
>                 <tasks>
>                     <tstamp>
>                         <format property="time" pattern="dd.MM.yyyy-HH.mm"
> locale="en" />
>                     </tstamp>
>                     <property name="timestamp" value="${time}-${user.name
> }"
> />
>                     <touch file=".build.timestamp.properties" />
>                     <echo file=".build.timestamp.properties"
> append="false"
> message="timestamp=${timestamp}" />
>                 </tasks>
>             </configuration>
>         </execution>
>         <execution>
>             <id>delete-timestamp-file</id>
>             <phase>clean</phase>
>             <goals>
>                 <goal>run</goal>
>             </goals>
>             <configuration>
>                 <tasks>
>                     <delete file=".build.timestamp.properties" />
>                 </tasks>
>             </configuration>
>         </execution>
>     </executions>
> </plugin>
> [...]
>
> and
>
> [...]
>
> <filters>
>     [...]
>     <filter>.build.timestamp.properties</filter>
> </filters>
>
>
> ----- Original Message -----
> From: "Julian Wood" <wo...@ucalgary.ca>
> To: "Maven Users List" <us...@maven.apache.org>
> Sent: Tuesday, May 30, 2006 10:43 PM
> Subject: Re: date in manifest
>
>
> > You can use the maven-buildNumber-plugin.
> >
> > http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html
> >
> > Near the bottom it tells you how to use a timestamp.
> >
> > There was some talk of making the build date a more globally  available
> > property (negating the need for this plugin), but I don't  know what it
> > is, or if it was done.
> >
> > J
> >
> > On 30-May-06, at 2:03 PM, raghurajan.x.gurunathan@jpmchase.com wrote:
> >
> >> Hi  All
> >>
> >> If i want to make entry of build date to mani-fest files how do i  do
> >> that?
> >>
> >> i know how to make entry to mani-fest but don't know what
> maven  variable
> >> has the value for date ??
> >>
> >> Anyone knows  it , please advise?
> >>
> >>
> >>
> >>
> >>
> >> Thanks,
> >> Raghu
> >
> > --
> > Julian Wood <wo...@ucalgary.ca>
> >
> > Software Engineer
> > Teaching & Learning Centre
> > University of Calgary
> >
> > http://tlc.ucalgary.ca
> >
> >
> >
> > ---------------------------------------------------------------------
> > 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: date in manifest

Posted by Kieran Brady <ki...@teamcgi.net>.
I tried te build number plugins without any success as it didn't seem happy 
to create a timestamp independently of SCM? I'm using CVS and it wasn't 
happy with it..

Instead I have this horrible hack! Our Maven setup seems to be an ever 
expanding collection of horrible hacks :-/

[...]
<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
            <id>create-timestamp-file</id>
            <phase>generate-resources</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <tstamp>
                        <format property="time" pattern="dd.MM.yyyy-HH.mm" 
locale="en" />
                    </tstamp>
                    <property name="timestamp" value="${time}-${user.name}" 
/>
                    <touch file=".build.timestamp.properties" />
                    <echo file=".build.timestamp.properties" append="false" 
message="timestamp=${timestamp}" />
                </tasks>
            </configuration>
        </execution>
        <execution>
            <id>delete-timestamp-file</id>
            <phase>clean</phase>
            <goals>
                <goal>run</goal>
            </goals>
            <configuration>
                <tasks>
                    <delete file=".build.timestamp.properties" />
                </tasks>
            </configuration>
        </execution>
    </executions>
</plugin>
[...]

and

[...]

<filters>
    [...]
    <filter>.build.timestamp.properties</filter>
</filters>


----- Original Message ----- 
From: "Julian Wood" <wo...@ucalgary.ca>
To: "Maven Users List" <us...@maven.apache.org>
Sent: Tuesday, May 30, 2006 10:43 PM
Subject: Re: date in manifest


> You can use the maven-buildNumber-plugin.
>
> http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html
>
> Near the bottom it tells you how to use a timestamp.
>
> There was some talk of making the build date a more globally  available 
> property (negating the need for this plugin), but I don't  know what it 
> is, or if it was done.
>
> J
>
> On 30-May-06, at 2:03 PM, raghurajan.x.gurunathan@jpmchase.com wrote:
>
>> Hi  All
>>
>> If i want to make entry of build date to mani-fest files how do i  do 
>> that?
>>
>> i know how to make entry to mani-fest but don't know what maven  variable
>> has the value for date ??
>>
>> Anyone knows  it , please advise?
>>
>>
>>
>>
>>
>> Thanks,
>> Raghu
>
> --
> Julian Wood <wo...@ucalgary.ca>
>
> Software Engineer
> Teaching & Learning Centre
> University of Calgary
>
> http://tlc.ucalgary.ca
>
>
>
> ---------------------------------------------------------------------
> 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: date in manifest

Posted by Julian Wood <wo...@ucalgary.ca>.
You can use the maven-buildNumber-plugin.

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

Near the bottom it tells you how to use a timestamp.

There was some talk of making the build date a more globally  
available property (negating the need for this plugin), but I don't  
know what it is, or if it was done.

J

On 30-May-06, at 2:03 PM, raghurajan.x.gurunathan@jpmchase.com wrote:

> Hi  All
>
> If i want to make entry of build date to mani-fest files how do i  
> do that?
>
> i know how to make entry to mani-fest but don't know what maven  
> variable
> has the value for date ??
>
> Anyone knows  it , please advise?
>
>
>
>
>
> Thanks,
> Raghu

--
Julian Wood <wo...@ucalgary.ca>

Software Engineer
Teaching & Learning Centre
University of Calgary

http://tlc.ucalgary.ca



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