You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Keith Irwin <ke...@keithirwin.com> on 2004/01/16 00:21:29 UTC

Constructing Dates on the Fly?

Folks--

I need to rename my war file to meet some hosting / production /process
requirement.

Changing the name is no problem.

However, I'd like to be able to insert a date in the middle of it so I
can do something like:

	project-date-lifecycle.war

Is there an obvious way to get a date (and format it) using jelly or
some other thing in maven.xml?

Perusing the jelly core tags, I suppose I could instantiate a
jave.util.Date object, then a simple date formatter object, but that
seems like a lot of work.

Alternately, I could manually change the <currentVersion/> element in
project.xml, or use some other property I manually set (using -D for
instance), but, well, it would be ever so much nicer if there was
something like:

	<j:setDate var="mydate" when="current" format="yyyy-MM-dd"/>

Do I dare hope?

Keith


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


Re: Constructing Dates on the Fly?

Posted by Keith Irwin <ke...@keithirwin.com>.
Ah hah!

I knew if I wrote to the list it would speed my discovery.  This seems
to work:

<goal name="productionWar">
  <ant:tstamp>
   <ant:format property="DSTAMP" pattern="yyyy-MM-dd"/>
  </ant:tstamp>
  <j:set var="${maven.war.final.name}" value="yo-${DSTAMP}-yo.war"/>
</goal>

Easy!

:)

Keith

On Thu, 2004-01-15 at 15:21, Keith Irwin wrote:
> Folks--
> 
> I need to rename my war file to meet some hosting / production /process
> requirement.
> 
> Changing the name is no problem.
> 
> However, I'd like to be able to insert a date in the middle of it so I
> can do something like:
> 
> 	project-date-lifecycle.war
> 
> Is there an obvious way to get a date (and format it) using jelly or
> some other thing in maven.xml?
> 
> Perusing the jelly core tags, I suppose I could instantiate a
> jave.util.Date object, then a simple date formatter object, but that
> seems like a lot of work.
> 
> Alternately, I could manually change the <currentVersion/> element in
> project.xml, or use some other property I manually set (using -D for
> instance), but, well, it would be ever so much nicer if there was
> something like:
> 
> 	<j:setDate var="mydate" when="current" format="yyyy-MM-dd"/>
> 
> Do I dare hope?
> 
> Keith
> 
> 
> ---------------------------------------------------------------------
> 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