You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2007/04/20 23:22:05 UTC
Subclassing the war plugin
Hi,
I am about to implement a plugin, which generates war files. Wait, I
hear you say, there already is a war plugin. Unfortunately, my war
files are very special and need to be created in a way, which the war
file cannot (and will not) fulfill.
Ok, basically there is no problem. I am subclassing AbstractMojo,
create an instance of WarMojo internally and delegate the parameters
to the internal instance. However, I have found another problem:
In the project, where I would like to use the plugin, I would want to declare
<packaging>war</packaging>
Unfortunately, that brings the maven-war-plugin into play, which I
would like to avoid. Of course, I can change that to
<packaging>mywar</packaging>
but that means changing the extension. I do like neither of the above ideas.
Any better suggestions?
Thanks,
Jochen
--
My cats know that I am a loser who goes out for hunting every day
without ever returning as much as a single mouse. Fortunately, I've
got a wife who's a real champ: She leaves the house and returns within
half an hour, carrying whole bags full of meal.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Stephane Nicoll <st...@gmail.com>.
Hi,
On 4/21/07, Franz Allan Valencia See <fr...@gmail.com> wrote:
...
> But if really don't like either approach, then you probably could just
> create your own version of the war plugin ( something like,
> org.apache.maven.plugins:maven-war-plugin:1.0-jochen ). So that using
> pluginManagement, you can nail down your project's war plugin version
> to your own. In that way, when maven tries to find
> org.apache.maven.plugins:maven-war-plugin:<some version>, it will see
> your version and use it.
Notet that this does not work with maven 2.0.x (i.e. having released
plugins with the same groupId/artifactId in two different
repositories).
Cheers,
Stéphane
>
> Cheers,
> Franz
>
> On 4/20/07, Stephane Nicoll <st...@gmail.com> wrote:
> > Hi,
> >
> > On 4/20/07, Jochen Wiedmann <jo...@gmail.com> wrote:
> > > Hi,
> > >
> > > I am about to implement a plugin, which generates war files. Wait, I
> > > hear you say, there already is a war plugin. Unfortunately, my war
> > > files are very special and need to be created in a way, which the war
> > > file cannot (and will not) fulfill.
> >
> > OK but is there a way you defined the necessary hooks you need? Maybe
> > this could be reused for somebody else.
> >
> > Thanks,
> > Stéphane
> >
> >
> >
> > >
> > > Ok, basically there is no problem. I am subclassing AbstractMojo,
> > > create an instance of WarMojo internally and delegate the parameters
> > > to the internal instance. However, I have found another problem:
> > >
> > > In the project, where I would like to use the plugin, I would want to declare
> > >
> > > <packaging>war</packaging>
> > >
> > > Unfortunately, that brings the maven-war-plugin into play, which I
> > > would like to avoid. Of course, I can change that to
> > >
> > > <packaging>mywar</packaging>
> > >
> > > but that means changing the extension. I do like neither of the above ideas.
> > >
> > > Any better suggestions?
> > >
> > >
> > > Thanks,
> > >
> > > Jochen
> > >
> > > --
> > > My cats know that I am a loser who goes out for hunting every day
> > > without ever returning as much as a single mouse. Fortunately, I've
> > > got a wife who's a real champ: She leaves the house and returns within
> > > half an hour, carrying whole bags full of meal.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: dev-help@maven.apache.org
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Franz Allan Valencia See <fr...@gmail.com>.
Good day to you, Jochen,
If you really think maven-war-plugin will not fulfill your war's
"special needs", then maybe your packaging is not really a war hence
you'd have to go with
<packging>mywar</packaging>
But if you think it really is a war, then you might want to extend the
maven-war-plugin.
But if really don't like either approach, then you probably could just
create your own version of the war plugin ( something like,
org.apache.maven.plugins:maven-war-plugin:1.0-jochen ). So that using
pluginManagement, you can nail down your project's war plugin version
to your own. In that way, when maven tries to find
org.apache.maven.plugins:maven-war-plugin:<some version>, it will see
your version and use it.
Cheers,
Franz
On 4/20/07, Stephane Nicoll <st...@gmail.com> wrote:
> Hi,
>
> On 4/20/07, Jochen Wiedmann <jo...@gmail.com> wrote:
> > Hi,
> >
> > I am about to implement a plugin, which generates war files. Wait, I
> > hear you say, there already is a war plugin. Unfortunately, my war
> > files are very special and need to be created in a way, which the war
> > file cannot (and will not) fulfill.
>
> OK but is there a way you defined the necessary hooks you need? Maybe
> this could be reused for somebody else.
>
> Thanks,
> Stéphane
>
>
>
> >
> > Ok, basically there is no problem. I am subclassing AbstractMojo,
> > create an instance of WarMojo internally and delegate the parameters
> > to the internal instance. However, I have found another problem:
> >
> > In the project, where I would like to use the plugin, I would want to declare
> >
> > <packaging>war</packaging>
> >
> > Unfortunately, that brings the maven-war-plugin into play, which I
> > would like to avoid. Of course, I can change that to
> >
> > <packaging>mywar</packaging>
> >
> > but that means changing the extension. I do like neither of the above ideas.
> >
> > Any better suggestions?
> >
> >
> > Thanks,
> >
> > Jochen
> >
> > --
> > My cats know that I am a loser who goes out for hunting every day
> > without ever returning as much as a single mouse. Fortunately, I've
> > got a wife who's a real champ: She leaves the house and returns within
> > half an hour, carrying whole bags full of meal.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> > For additional commands, e-mail: dev-help@maven.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Jochen Wiedmann <jo...@gmail.com>.
On 4/21/07, Stephane Nicoll <st...@gmail.com> wrote:
> OK but is there a way you defined the necessary hooks you need? Maybe
> this could be reused for somebody else.
I have simply duplicated the war plugins properties and transfer the
values using
ReflectionUtils.getFieldByNameIncludingSuperclasses
Could possibly be made generic, but at least the definition of the
parameter fields must be done manually.
Jochen
--
My cats know that I am a loser who goes out for hunting every day
without ever returning as much as a single mouse. Fortunately, I've
got a wife who's a real champ: She leaves the house and returns within
half an hour, carrying whole bags full of meal.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Stephane Nicoll <st...@gmail.com>.
Hi,
On 4/20/07, Jochen Wiedmann <jo...@gmail.com> wrote:
> Hi,
>
> I am about to implement a plugin, which generates war files. Wait, I
> hear you say, there already is a war plugin. Unfortunately, my war
> files are very special and need to be created in a way, which the war
> file cannot (and will not) fulfill.
OK but is there a way you defined the necessary hooks you need? Maybe
this could be reused for somebody else.
Thanks,
Stéphane
>
> Ok, basically there is no problem. I am subclassing AbstractMojo,
> create an instance of WarMojo internally and delegate the parameters
> to the internal instance. However, I have found another problem:
>
> In the project, where I would like to use the plugin, I would want to declare
>
> <packaging>war</packaging>
>
> Unfortunately, that brings the maven-war-plugin into play, which I
> would like to avoid. Of course, I can change that to
>
> <packaging>mywar</packaging>
>
> but that means changing the extension. I do like neither of the above ideas.
>
> Any better suggestions?
>
>
> Thanks,
>
> Jochen
>
> --
> My cats know that I am a loser who goes out for hunting every day
> without ever returning as much as a single mouse. Fortunately, I've
> got a wife who's a real champ: She leaves the house and returns within
> half an hour, carrying whole bags full of meal.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Jochen Wiedmann <jo...@gmail.com>.
On 4/21/07, Max Bowsher <ma...@ukf.net> wrote:
> Not necessarily. Maven plugins are <packaging>maven-plugin</packaging>,
> but have extension .jar - the two do not have to be the same.
Hmmm, that's a good hint. Thank you!
Jochen
--
My cats know that I am a loser who goes out for hunting every day
without ever returning as much as a single mouse. Fortunately, I've
got a wife who's a real champ: She leaves the house and returns within
half an hour, carrying whole bags full of meal.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: Subclassing the war plugin
Posted by Max Bowsher <ma...@ukf.net>.
Jochen Wiedmann wrote:
> I can change that to
>
> <packaging>mywar</packaging>
>
> but that means changing the extension.
Not necessarily. Maven plugins are <packaging>maven-plugin</packaging>,
but have extension .jar - the two do not have to be the same.
Max.