You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2017/01/30 18:18:50 UTC

Finding another plugins configuration

Hi,

I'd like to create a plugin, which is intended to generate resources
for a web application.

In other words, the target directory would be the value, which is
typically configured as the webappDirectory property of the
maven-war-plugin.

To get that value, I see two options:

a) I create a property webappDirectory in my own plugin, and force the
user to configure that property.

b) I find the projects maven-war-plugin, and read that objects value.

Is b) possible? How?

Thanks,

Jochen


-- 
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

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


Re: Finding another plugins configuration

Posted by Tamás Cservenák <ta...@cservenak.net>.
Hi Jochen,

Yes, I just wanted to show you some code how to get the POM/model, and at
that point, you can do _whatever you want_ to it (this is how for example
nexus staging plugin "installs" itself btw). Still, you need to be very
careful _what_ you do here... is VERY easy to screw things up.

For your case I'd still propose option a) for solving your problem :)
Less magic, less headache (in future)

Thanks
T

On Fri, Feb 10, 2017 at 1:28 PM Jochen Wiedmann <jo...@gmail.com>
wrote:

> Hi, Tamas,
>
> thanks for the link to the configuration-maven-plugin. If I do get
> this right, you are essentially introducing a way to reuse
> configuration snippets within the POM.
>
> Which would of course be an interesting idea. I still wonder, whether
> it isn't possible to find another plugin within my own. (Ultimately,
> this might allow for other scenarios, like reusing code.)
>
> Thanks,
>
> Jochen
>
>
>
> --
> The next time you hear: "Don't reinvent the wheel!"
>
>
> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
>
-- 
Thanks,
~t~

Re: Finding another plugins configuration

Posted by Jochen Wiedmann <jo...@gmail.com>.
Hi, Tamas,

thanks for the link to the configuration-maven-plugin. If I do get
this right, you are essentially introducing a way to reuse
configuration snippets within the POM.

Which would of course be an interesting idea. I still wonder, whether
it isn't possible to find another plugin within my own. (Ultimately,
this might allow for other scenarios, like reusing code.)

Thanks,

Jochen



-- 
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

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


Re: Finding another plugins configuration

Posted by Tamás Cservenák <ta...@cservenak.net>.
Jochen,

for how it could work, take this example (demo plugin doing similar thing
you want):
https://github.com/cstamas/configuration-maven-plugin

That above if clearly "hacking" :)

As Herve said, no "proper" way to do it, except adding "standard" property
(like those mentioned by Herve) and submitting a patch to war plugin (to
start using it) and use the same in your plugin.

HTH,
Tamas

On Fri, Feb 3, 2017 at 5:10 PM Jochen Wiedmann <jo...@gmail.com>
wrote:

> On Fri, Feb 3, 2017 at 10:27 AM, Hervé BOUTEMY <he...@free.fr>
> wrote:
> > b) is probably possible, but not recommended
>
> A few words on how this would work, and *why* it is not recommended? I
> am not interested in finding a solution for all Maven users, Just
> something that works for me and my team.
>
> Jochen
>
>
>
> --
> The next time you hear: "Don't reinvent the wheel!"
>
>
> http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
> --
Thanks,
~t~

Re: Finding another plugins configuration

Posted by Jochen Wiedmann <jo...@gmail.com>.
On Fri, Feb 3, 2017 at 10:27 AM, Hervé BOUTEMY <he...@free.fr> wrote:
> b) is probably possible, but not recommended

A few words on how this would work, and *why* it is not recommended? I
am not interested in finding a solution for all Maven users, Just
something that works for me and my team.

Jochen



-- 
The next time you hear: "Don't reinvent the wheel!"

http://www.keystonedevelopment.co.uk/wp-content/uploads/2014/10/evolution-of-the-wheel-300x85.jpg

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


Re: Finding another plugins configuration

Posted by Hervé BOUTEMY <he...@free.fr>.
b) is probably possible, but not recommended

When we want to share some configuration between plugins, the usual solution is 
to define a convention on a property name: see for example maven.test.skip that 
is supported both by maven-compiler-plugin [1], Surefire [2], nar-maven-plugin 
in multiple goals [3] [4] [5]

Regards,

Hervé

[1] http://maven.apache.org/plugins/maven-compiler-plugin/testCompile-mojo.html#skip

[2] http://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#skip

[3] http://maven-nar.github.io/nar-test-mojo.html#skipTests

[4] http://maven-nar.github.io/nar-test-unpack-mojo.html#skipTests

[5] http://maven-nar.github.io/nar-testCompile-mojo.html#skipTests

Le lundi 30 janvier 2017, 19:18:50 CET Jochen Wiedmann a écrit :
> Hi,
> 
> I'd like to create a plugin, which is intended to generate resources
> for a web application.
> 
> In other words, the target directory would be the value, which is
> typically configured as the webappDirectory property of the
> maven-war-plugin.
> 
> To get that value, I see two options:
> 
> a) I create a property webappDirectory in my own plugin, and force the
> user to configure that property.
> 
> b) I find the projects maven-war-plugin, and read that objects value.
> 
> Is b) possible? How?
> 
> Thanks,
> 
> Jochen



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