You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Bram Patelski <br...@gmail.com> on 2011/10/01 00:38:23 UTC

Re: Insert a timestamp into an archetype?

Okay, I see.

Well, I'm not sure if there is a filter-option for current time.
I did once write a custom mojo for renaming packages (so directories) based
on the archetype artifactId.
That way if I used the archetype to generate a new project called:
- groupId: org.apache.whatever
- artifactId: myNewProject
I could auto-rename my class-package to:
org.apache.whatever.myNewProject

I also had the idea (didn't make it... yet?) of writing a mojo for filtering
Word-templates of the documentation.
Maybe you could use an approach like this. Obviously you have "new Date()"
at your disposal if you write your own mojo.
But it would be cleaner to have the filter-option like you tried.

Good luck

On Fri, Sep 30, 2011 at 23:21, Dennis Lundberg <de...@apache.org> wrote:

> Hi Bram
>
> Thanks for your suggestion. My current approach is to use filtering to
> insert the timestamp into the .java file.
>
> The problem I am having is actually getting hold of the appropriate
> value of a timestamp. It should reflect the point in time when my
> archetype is used to generate a new project.
>
> On 2011-09-30 22:03, Bram Patelski wrote:
> > You could use filtering?
> >
> > On Fri, Sep 30, 2011 at 22:01, Dennis Lundberg <de...@apache.org>
> wrote:
> >
> >> Hi
> >>
> >> I'm creating an archetype, with a bunch of files. In the .java files I
> >> want to insert a timestamp. When I use the archetype to generate a new
> >> project, the .java files should show when they were generated.
> >>
> >> Is this possible?
> >>
> >> I have tried inserting ${maven.build.timestamp} as the default value in
> >> my archetype-metadata.xml file, but it doesn't seem to work.
> >>
> >> --
> >> Dennis Lundberg
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: users-help@maven.apache.org
> >>
> >>
> >
>
>
> --
> Dennis Lundberg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>