0

I have 3 modules which are linked to a parent project similar to this.

root (pom.xml)
   +--- mod1 (pom.xml)
   +--- mod2 (pom.xml)
   +--- mod3 (pom.xml)

Mod3 is the module used for packaging purposes. I have some configuration files in config folder of mod1 and mod2. I need to update some values in these property files using profile and filter. Is it possible to have a common profile and filter for these two modules. If so in which pom.xml should I include the profile and filter details.

Anand B
  • 2,997
  • 11
  • 34
  • 55
  • Put the configuration files where they belong. The question is: When do you need to update the config file during the packaing in mod3 ? – khmarbaise Aug 17 '12 at 06:38
  • Yes I need to update the config files during the packaging in mod3 – Anand B Aug 17 '12 at 06:59
  • 1
    Than it sounds like they belong to mod3 and not to mod1 and mod2. Just move them to mod3 and do the filtering there. – khmarbaise Aug 17 '12 at 07:12
  • Actually I move the files from mod1 and mod2 to package defined in pack.xml(Assembly xml) defined in mod3. – Anand B Aug 17 '12 at 09:02

1 Answers1

0

You can define the same profile in all modules (with the same id), and when you call this profile from the paren module, this profile will be activated in child modules.

If you execute from parent module

mvn -P test clean package

It produces the same call in the tree call modules. So in each pom.xml you specify what filtering you need.

Hope this help.

kothvandir
  • 2,111
  • 2
  • 19
  • 34
  • But I need the filters to be used only for 2 modules. I need not specify these filters in all the pom.xml – Anand B Aug 17 '12 at 09:00
  • no need. You can specify in module1 and module2 your filter within the profile tag, so the filters will be applied when you activate the profile. If you don't need filtering in module3 (for example), dont include the filtering or don't include the profile. – kothvandir Aug 17 '12 at 17:03