> -----Original Message-----
> From: Erik Husby [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 21, 2004 9:01 PM
> To: Maven Users List
> Subject: Re: The Genapp plugin
>
>
> Charles Daniels wrote:
>
> >Works like a charm for my templates.
> >
> >-- Chuck
> >
> >
> How do you make your templates available to the rest of your company? Do
> you provide a script that wraps "maven genapp" with appropriate
> parameters?

Good question.  This is something I have been wrestling with recently
myself.  I have created a plugin specifically to aid in building
applications using my company's software.  Part of what the plugin provides
is a template for starting a new project.  One thing I had considered was
creating an alternative genapp goal as part of the plugin with a name of the
form prefix:genapp, which would use the genapp tag supplying the location of
my template repository within my plugin.

However, I opted not to create an alternative goal just to pickup my custom
template.  I want to be able to use the standard genapp goal.  After digging
through the genapp plugin.jelly file, I noticed that it will check for
templates in the ${user.home}/.maven/template directory, if you specify a
template that it does not have in its own plugin resources.  I decided to
populate that directory with my custom template files.  In order to do this
without requiring developers to do any work (other than install my plugin),
I decided to create a genapp preGoal in my plugin.  The preGoal simply
copies my template files to the ${user.home}/.maven/template directory so
that genapp can find my template.

The only thing I have to do now is check the files in that directory against
the files in my plugin so that I only update the template directory if the
plugin contains newer files.  Here's the preGoal in my plugin:

  <preGoal name="genapp">
    <!-- TODO: Delete/copy only when necessary -->
    <ant:delete dir="${user.home}/.maven/template/mytemplate"/>
    <ant:copy todir="${user.home}/.maven/template/mytemplate"
preservelastmodified="true">
      <ant:fileset dir="${plugin.resources}/genapp/mytemplate"/>
    </ant:copy>
  </preGoal>

I first delete my template directory in case a new release of my plugin has
eliminated or moved any template files.

I hope that helps.

-- Chuck

>
> --
> Erik Husby
> Team Lead for Software Quality Automation
> Broad Institute of MIT and Harvard
> Rm. 2192  320 Charles St
> Cambridge, MA 02141-2023
> mobile: 781.354.6669, office: 617.258.9227, [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to