开发者

Parent pom and maven goals for only war projects

I have a multi module maven project. It has 5 module and 2 of them are web projects.

I want to customize my plugins to be run at only war projects. I mean at parent pom level I would like to trigger my goals and only my war projects will be affected. Is there any way for it?

开发者_Python百科As a result of this, I will not have duplicated configurations at my war projects pom.

Thanks


You can build a war parent pom (where your war projects are inheriting from) and a general parent pom (where everyone else is inheriting from).

        general parent
          /      \   \
   war parent     \   \
      /  \         \   \  
 war1    war2  other1  other2

For building you may have a seperate build pom, having all the above as modules.

HTH


I have faced the same problem numerous times and I have come to the conclusion that the best solution is as follows:

cool-master
|-+ parents
| |- cool-parent
| |- cool-parent-web
|
|- module1
|- module2
|- module3
|- module-web1
|- module-web2

In the above example there are three types of modules:

  • parent POM-s (cool-parent, cool-parent-web)

  • non-web aps (extending cool-parent)

  • webapps (extending cool-parent-web)

In the parents you can define settings which are specific for the different types of modules. For example in the cool-parent define non-webapp related stuff, wheres in the cool-parent-web you can have all the fancy stuff like maven-war-plugin, jetty-maven-plugin, etc. I generally have the cool-parent-web extend the cool-parent in order to avoid having to duplicate dependencies, plugins settings and etc.

In the cool-parent-web define a <pluginManagement/> section and set up all the stuff for your plugins and then just use them across your web modules.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜