1

I have four projects, Proj-A, Proj-B, Proj-C and Proj-D. Proj-B, Proj-C and Proj-D all have Proj-A as a dependency inside their POMs. B,C, and D are not dependent on each other. I have put profiles in Proj-A in order to allow parametrization of some settings (jpa settings for dev, test and prod db connections). That works fine.

Is there a way to build the other projects, and have them pass the proper build profile to use when building the dependent project? If so how? I would like to do this without putting properties in the settings.xml file for the maven repository.

I am familiar with Maven2 but by no means an expert, any ideas?

DMHarris
  • 51
  • 3
  • Will the contents of proj-A.jar differ depending on which profile was active at the time it was built? Or is proj-A.jar the same no matter what, and it's only proj-B/C/D whose jars will differ based on the parameters? – 333kenshin Oct 30 '14 at 05:59

1 Answers1

0

As far as I know there is no a beautiful way :/

You can inherit profiles from a parent to its children. But the planned implementation of mixins is still open

What I've seen is that people create a parent containing the profiles and then use it as parent for the project-parent pom.xml

What is also possible is to use a different (released) parent for modules:

project-parent (having modules configured)
    /module1 -> using webservice parent pom
    /module2 -> using rest parent pom

That is not the usual structure but one way to share configuration for related modules in different projects.

Community
  • 1
  • 1
wemu
  • 7,952
  • 4
  • 30
  • 59