You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Status DRAFT
Version 
Issue(s) 
Sourcesconsumer-pom study
Developer(s)Hervé Boutemy

 

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).

Other build tools don't suffer from this issue: their build format is kept internal and a POM is produced only while publishing artifacts to Maven repositories, with information just for artifacts consumers but no build instruction.

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 or as dependencyManagement import (dependency scope="import" at build time).

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 only (eventually using new version/format): this use case won't cause issues.

Consumer POM fields

First step is to define which fields from POM v4 we want to keep in consumer POM:

fieldrequired for consumerproposed for consumerproposed for build onlycomment
<modelVersion/>
 (plus) not absolutely required, but kept as usual convention
<parent>
(minus) (plus)content inlined in consumer POM
<groupId/>
<artifactId/>
<version/>
(plus)   
<packaging/>
 (plus) not absolutely required, since packaging is more a build configuration than something consumers may use
<name/>
(plus)  necessary because of minimal requirements for central
<description/>
(plus)  necessary because of minimal requirements for central
<url/>
(plus)  necessary because of minimal requirements for central
<inceptionYear/>
 (plus)  
<organization>
 (plus)  
<licenses>
(plus)  necessary because of minimal requirements for central
<developers>
(plus)  necessary because of minimal requirements for central
<contributors>
  (question) 
<mailingLists>
  (question) 
<prerequisites>
(plus)  used for plugins, to define runtime Maven version prerequisite
<modules/>
(minus) (plus) 
<scm>
(plus)  necessary because of minimal requirements for central
<issueManagement>
 (plus)  
<ciManagement>
(minus) (plus) 
<distributionManagement>
(minus) (plus) 
<properties>
(minus) (plus)values inlined in consumer POM
<dependencyManagement>
(minus) (plus) 
<dependencies>
(plus) without system scope (plus) with system scopesystem scoped dependencies removed in consumer POM
<repositories>
(question) (question)need to check if repositories configured in dependencies are used during resolution
<pluginRepositories>
(minus) (plus) 
<build>
(minus) (plus)(thumbs up) this is where the addition of new configuration to enhance Maven build features will be the most useful
<reports/>
(minus) (minus)let's remove this old Maven 1 compatibility field...
<reporting>
(minus) (plus) 
<profiles>
(plus)   
    <id/>
(plus)   
    <activation>
(question)  keep JDK and OS activation only? removing other activations, which are build time
    <dependencies>
(plus)   
    <build>
    <modules/>
    <distributionManagement>
    <properties>
    <dependencyManagement>
    <repositories>
    <pluginRepositories>
    <reports/>
    <reporting>
(minus) (plus)since removed from base model

     

 

 

 

  • No labels