I have a maven archetype project. When I use this archetype I want that some files report the actual date. I tried with $date but Velocity does not recognize it. I found something called DateTools but I don't know how can I use it. It's the first time I use Velocity.
Unfortunately, the Maven Archetype plugin doesn't come bundled with Velocity Tools. I've added it by modifying the Maven Archetypes Plugin. Follow these steps, presuming you're using Maven 2.2.1:
svn co -q http://svn.apache.org/repos/asf/maven/archetype/tags/maven-archetype-2.2
cd maven-archetype-2.2
curl -k -O https://raw.github.com/gist/3404715/59c7fa1c20c60e2a165de4109c2acffb8026febd/velocity-tools.patch
patch -p0 -i velocity-tools.patch
mvn install
The modified Maven Archetype plugin will now be installed locally.
$date
usage in your templates should now render, e.g.
The date is $date
...to:
The date is Aug 20, 2012 4:40:22 PM
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With