I'm trying to migrate an existing big multi-module project from Maven 2 to Maven 3. The project does heavy use of profiles.xml to define settings for different environments (development, staging, production); and as you may know, profiles.xml is no more in Maven 3.
My intention is to make this transition as seamless as possible, so using settings.xml per machine is not an option, neither asking everyone to run maven with -s and a new settings file.
The parent pom is already quite extensive, since it configures plugins, repositories and dependencies for all modules; and it also uses a few profiles activated by OS to set proper classifiers on dependencies which are platform dependent. Therefore, I would rather not place all config options for all environments on the pom itself to avoid cluttering it.
I'm looking for a way to keep the environment configuration separate from the pom; yet common to all modules (present or future). Ideally, this means the solution requires just to edit the parent pom, and not the submodule's, making this issue transparent to all future submodules.
I've looked into properties-maven-plugin
, but can't seem to get it to load the same file for all submodules, it looks for the file within the submodule itself, or if I define a relative path by using ${project.basedir}/../
it will fail for the parent project (since I can't define a build plugin in the super pom for the children, and not execute it on the parent too).
I've also looked into having separate property files per environment and setting a filter in the parent pom, but I run into the same issue.
So far the only thing I can get to work is editing all submodule's poms and manually setting the filter to ${project.basedir}/../config/${env}.property
; but this certainly doesn't meet the criteria of being transparent to future modules and I find it very repetitive to have to set it on each and every submodule there is...
Any ideas are more than welcome, thanks in advance.