Page properties | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Rationale
Maven is stuck on POM v4 for a long time now, because changing the POM version and publishing artifacts on Maven Central with this new model would break consumers using either older Maven versions or other build tools (that use POM v4 as a compatibility format).
...
Maven could apply same strategy: generate a consumer-only POM when publishing artifacts to a repository, with minimal information. The original POM is then called "build" POM since it contains instructions to build the artifact and the generated simplified POM is called "consumer" POM since it's intended for artifact consumers. Once this is done, we can have new build POM versions, which will require newer Maven versions to build, while consumer POM remains compatible with classical POM v4: the only requirement is to be able to generate a consumer POM (a simplified POM v4) from the original build POM used during build: flatten-maven-plugin has already proven that generating a simplified POM from the original POM and publishing it to Maven repository is feasible.
Special case: parent POMs (packaging=pom)
Parent POMs (which are POMs with "pom" packaging) don't really have any meaning as consumer POM: there is no dependency artifact to get from them.
They are useful only as build POMs. Moreover, they are required in Maven repositories to be used either as parent POM either as dependencyManagement import.
Then non-pom-packaging POMs will be published in Maven repositories as consumer POM (v4) but pom-packaging POMs will be published in Maven repositories as build POM (eventually new version/format).
Consumer POM fields
First step is to define which fields from POM v4 we want to keep in consumer POM:
field | required for consumer | proposed for consumer | proposed for build only | comment | |
---|---|---|---|---|---|
<modelVersion/> | |||||
<parent> | content inlined in consumer POM | ||||
<groupId/> <artifactId/> <version/> | |||||
<packaging/> | |||||
<name/> | |||||
<description/> | |||||
<url/> | |||||
<inceptionYear/> | |||||
<organization> | |||||
<licenses> | |||||
<developers> <contributors> | |||||
<mailingLists> | |||||
<prerequisites> | |||||
<modules/> | | ||||
<scm> | |||||
<issueManagement> | |||||
<ciManagement> | | ||||
<distributionManagement> | | ||||
<properties> | | values inlined in consumer POM | |||
<dependencyManagement> | |||||
<dependencies> | system scoped dependencies removed in consumer POM | ||||
<repositories> | | need to check if repositories configured in dependencies are used during resolution | |||
<pluginRepositories> | | ||||
<build> | |||||
<reports/> | |||||
<reporting> | |||||
<profiles> | |||||
<id/> | | ||||
<activation> | | ||||
<properties> | |||||
<dependencies> | |||||
<build> <modules/> <distributionManagement> <dependencyManagement> <repositories> <pluginRepositories> <reports/> <reporting> |
...