Search code examples
javamavenmaven-3pom.xmlmaven-profiles

How to reuse Maven profile?


We have multiple independent maven projects that use two profiles. Currently, these profiles are part of pom.xml and copied to all projects. Is there a way to reuse the Maven profile across all services?


Solution

  • You can place profiles in a parent POM and use that parent in your projects.

    Then the projects inherit the profiles from the parent POM.

    Note that you do not need to create a multi-module project for that. An ordinary parent POM suffices.