apache / apache/maven

[MNG-8072] Add a consumerPomFile to the MavenProject

Open
#10,863 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

**[Christoph Läubrich](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=laeubi)** opened **[MNG-8072](https://issues.apache.org/jira/browse/MNG-8072?redirect=false)** and commented

Currently there is some vague definition of a "build pom" versus a "consumer pom":

* https://maven.apache.org/studies/consumer-pom/
* https://cwiki.apache.org/confluence/display/MAVEN/Build+vs+Consumer+POM

there are also some plugins around to work with this e.g.
* https://tycho.eclipseprojects.io/doc/latest/tycho-packaging-plugin/update-consumer-pom-mojo.html
* https://www.mojohaus.org/flatten-maven-plugin/plugin-info.html

but there are some issues:
1. Maven makes some assumptions about its "file", e.g setting the file changes the basedir
2. Even though there is a setPomFile method that do not change the basedir e.g. a parent ref by default would be broken
3. once we change the file, there is a mismatch between the pom on disk and the model
4. it is not possible for a plugin to know the original file and the consumer file, e.g. if I want to deploy the original file e.g. with classifier "pom-build"
5. because of this usually "consumer pom plugins" generate the the new pom to a new file in the project root, where it actually not belongs to and leaves the file even after mvn clean if no special actions are taken.

I therefore like to suggest to enhance the MavenProject with one more method set/getConsumerPom that fills this gap, then plugins working on the consumer pom can set the file there and e.g. https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html can look there first, or even have an option to deploy both poms automatically if they differ.

Of course this will be nothing happen right now but looks like something that can become useful over time and maybe fully adapted in Maven4.

---

**Remote Links:**
- [GitHub Pull Request #1437
](https://github.com/apache/maven/pull/1437)

Contributor guide

Open the contributing guide

Research direction

Start by reading the MavenProject API discussion and the linked consumer-POM references, then inspect the deploy plugin's deploy-mojo.html behavior and pull request #1437. The issue is done when the project has an agreed and implemented way to track a consumer POM separately from the original POM, including how deployment should use or publish them.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.