Maven "conditional" parent POM?

Max Spring

What's the best structure for a (multi-module) Maven project which should build "in the wild" without any Maven repository manager and can easily build within my organization where deployments should happen to my Maven repository manager?

Ideally, I would have two different paren POMs for each situation. But unfortunately, I can't use a Maven property to pass the correct value for each situation, because the property expression in the parent POM reference doesn't get interpolated, if I try something like

<parent>
  <groupId>org.example</groupId>
  <artifactId>${root.pom}</artifactId>
  <version>1.0-SNAPSHOT</version>
  <relativePath/>
</parent>
...
<properties>
  <root.pom>wild-parent</root.pom>
</properties>

Added a minimalistic project which shows a crude approach to solve this by patching the parent POM via sed.

Max Spring

This response on the maven-users mailing list pointed me in the direction to use Maven properties to pass in the in-house specifics.

I updated the example project.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Maven parent POM: Circular dependencies

From Dev

Maven: how to not depend on Parent POM

From Dev

How to create Maven Parent POM speciific to organization?

From Dev

maven parent pom with different child versions

From Dev

How to integrate a maven project with parent pom as module?

From Dev

Source code versioning of Maven Parent POM

From Dev

How to skip Maven plugin parent pom execution?

From Dev

maven-compiler-plugin in parent pom

From Dev

Maven PluginManagement Variable Binding from Parent POM

From Dev

maven parent pom with different child versions

From Dev

How to integrate a maven project with parent pom as module?

From Dev

Removing maven dependancies of child pom from parent pom

From Dev

How to release a Maven submodule without releasing the parent POM?

From Dev

How to override Maven 3.0 parent plugin properties from child pom

From Dev

Maven war plugin, not getting dependencies from parent pom

From Dev

with maven is it possible to "add to" a property or plugin value specified in a parent pom?

From Dev

Maven: Downloading a parent pom from the repository deletes repositories tag

From Dev

Maven: How to reference the build directory of a child project in a parent POM?

From Dev

How to make maven to obtain release parent pom instead of latest?

From Dev

Non-resolvable parent POM for Maven (Spring Starter Project)

From Dev

Avoid referencing parent pom in maven multi module project

From Dev

How to override Maven 3.0 parent plugin properties from child pom

From Dev

Maven: Downloading a parent pom from the repository deletes repositories tag

From Dev

Running docker-maven-plugin on the very end of parent pom building

From Dev

how to avoid inheritance of <site> and <url> from Maven parent POM?

From Dev

How to exclude the parent pom dependency inside inherited child dependency for Maven?

From Dev

Maven - How/Why/Should it work to set the parent version to be based on a property defined in the parent pom?

From Dev

In maven, how can I refer to a parent pom that does not exist at that location on the file system?

From Dev

Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host)

Related Related

  1. 1

    Maven parent POM: Circular dependencies

  2. 2

    Maven: how to not depend on Parent POM

  3. 3

    How to create Maven Parent POM speciific to organization?

  4. 4

    maven parent pom with different child versions

  5. 5

    How to integrate a maven project with parent pom as module?

  6. 6

    Source code versioning of Maven Parent POM

  7. 7

    How to skip Maven plugin parent pom execution?

  8. 8

    maven-compiler-plugin in parent pom

  9. 9

    Maven PluginManagement Variable Binding from Parent POM

  10. 10

    maven parent pom with different child versions

  11. 11

    How to integrate a maven project with parent pom as module?

  12. 12

    Removing maven dependancies of child pom from parent pom

  13. 13

    How to release a Maven submodule without releasing the parent POM?

  14. 14

    How to override Maven 3.0 parent plugin properties from child pom

  15. 15

    Maven war plugin, not getting dependencies from parent pom

  16. 16

    with maven is it possible to "add to" a property or plugin value specified in a parent pom?

  17. 17

    Maven: Downloading a parent pom from the repository deletes repositories tag

  18. 18

    Maven: How to reference the build directory of a child project in a parent POM?

  19. 19

    How to make maven to obtain release parent pom instead of latest?

  20. 20

    Non-resolvable parent POM for Maven (Spring Starter Project)

  21. 21

    Avoid referencing parent pom in maven multi module project

  22. 22

    How to override Maven 3.0 parent plugin properties from child pom

  23. 23

    Maven: Downloading a parent pom from the repository deletes repositories tag

  24. 24

    Running docker-maven-plugin on the very end of parent pom building

  25. 25

    how to avoid inheritance of <site> and <url> from Maven parent POM?

  26. 26

    How to exclude the parent pom dependency inside inherited child dependency for Maven?

  27. 27

    Maven - How/Why/Should it work to set the parent version to be based on a property defined in the parent pom?

  28. 28

    In maven, how can I refer to a parent pom that does not exist at that location on the file system?

  29. 29

    Maven and Spring Boot - non resolvable parent pom - repo.spring.io (Unknown host)

HotTag

Archive