Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reuse plugin configuration without inheriting from parent pom

Tags:

maven

We have a multi module project with a root pom.

    Root
    |->a
    |->b
    |->c
    |->d

The parent pom for a,b,c and d is "X" which isn't owned by us, so I can't do any modifications here.

Also I can't change my parent as all my child projects are dependent on "X".

The problem that I face is I'm duplicating the same plugin configuration in all the submodules as I can't add the configuration to the centralized parent and inherit the same.

Can anyone suggest me how to reuse the plugin configurations in all child modules instead of duplicating it?

like image 881
Arvind Hariharan Avatar asked Dec 08 '25 09:12

Arvind Hariharan


1 Answers

If the required plugin configurations are in X, then you should do nothing, because plugins are inherited.

If X doesn't have the required plugin configurations, you can create a pom that will be a common root of your A,B,C,D modules:

The hierarchy will be:

X
|__ MY_CUSTOM_ROOT
    |__ A
    |__ B
    |__ C
    |__ D 

This MY_CUSTOM_ROOT will contain the plugin definitions that will be inherited automatically A,B,C,D

If you want to make sure what exactly gets inherited, use mvn help:effective-pom

like image 64
Mark Bramnik Avatar answered Dec 11 '25 22:12

Mark Bramnik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!