Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Excerpt

The next generation Project Object Model to be used by Maven 5.0+

Background

Maven uses the Project Object Model as a descriptor for the declarative build requirements of a project.

  • Maven 1.x used a model which contained a <modelVersion>3.0.0</modelVersion> element as an immediate child of the root. 
  • Maven 2.x / 3.x has used a <modelVersion>4.0.0</modelVersion> element. 

Due to the way Maven has been implemented, the current release versions will consider any modelVersion other than the one that they target as invalid and will fail to parse the model.

For build time concerns, this is not that major a concern, and in fact may be desirable behaviour, e.g. I should not be able to build a Maven 2.x / 3.x project with Maven 1.x.

Where the modelVersion becomes a constraint, however, is when it comes to transitive dependency resolution. The Maven Central repository has grown in popularity, and now the consumers of the information in central are no longer only Apache Maven. There are other build tools that parse the POM to extract dependency information, e.g. Apache BuildrGradleApache Ivysbt, etc. As these build tools are not under the control of the Apache Maven project, we risk breaking their ability to parse the POM as a unit of dependency expression if we modify the pom schema or model version.

While we could change the schema if we "forked" the central repository, the experience from the previous reposotory fork (for the Maven 1.x / Model Version 3.0.0 to Maven 2.x / Model Version 4.0.0 transition) was traumatic and a repeat is generally considered to be a Bad Plan™.

The result of all this is that the Apache Maven project has been unable to evolve our POM to reflect the new needs.

The current plan for a Path Forward™ uses three legs:

  1. We keep deploying modelVersion 4.0.0 poms to the repository as a best effort expression of the dependency information of artifacts such that legacy clients can continue to consume artifacts deployed with non-legacy clients.
  2. We deploy a dependency-only model using a defined contract for forwards compatibility (to allow for future evolution) using a different file extension
  3. The POM then becomes a build-time only concern and does not need to be deployed to the repository - except for those cases where the pom may be used as either a parent or a mix-in

 

 

Overview

TODO write this up... I'm just dumping stuff I have done on the mail thread here to make it easier to collaborate:

...

  • Content to include in the POM: 
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-50
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3726
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-4506
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-4921
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-2216
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3608
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3879
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5926
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-2916
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5563
       (perhaps it is a legitimate concern for plugins to require parameters that have defined values from somewhere... unclear if this affects the POM though) 
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5900
      Open question do we want properties? and if we do, what interpolation rules would apply... how would parent, mix-in, platform, profiles etc take effect...
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5657
      WONT FIX I do not see the value in splitting content out of the pom... that way leads to profiles.xml which was madness
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5659
      WONT FIX I do not see the value in splitting content out of the pom... that way leads to profiles.xml which was madness
  • supports / provides type concepts: 
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-177
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5652
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-1977
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-2316
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-2316
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5867
  • Versioning
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-624
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-4173
       (should just do this for 5.0.0. No more plugin version "magic")
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5517
      WONT FIX I do not see the value in moving from the range syntax to a less mathematically complete syntax
  • Lifecycle related changes
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-193
       (since the symmetry will feed into the lifecycle definition syntax perhaps)
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-683
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3522
       (effectively superseded as you can augment the lifecycle from within the POM and thus provide any additional phases you require in order to ensure the sequencing required)
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5384
       (this one is really important as we want to be able to enable light-weight multi-module builds that just don't fail where "clean install" would succeed - solving this will mean that the reactor can proceed across all modules as required in order to deliver the requirements of the "driving" module(s))
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5665
       (need to ensure that we address this need in the lifecycle declaration syntax)
  • Scope related changes
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-1867
       (effectively addressed above as we remove all "special" scopes replacing them with convention)
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-6107
  • Better profile activation
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3326
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3826
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5650
  • How to format the POM
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-3397
       /
      Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5653
       (effectively addressed in the current proposal)
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-6061
       switching to a DSL should be considered... though I suspect a new compact XML would be less of an issue while retaining some ability to allow earlier maven versions to at least print semi-sensible errors if attempt is made to build new pom with old maven
  • Mix-ins
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5102
       / 
      Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5588
       (should be addressed with the current proposal, but need to review what the ask in this issue was to see if any gaps exist)
    • Jira
      serverASF JIRA
      serverId5aa69414-a9e9-3523-82ec-879b028fb15b
      keyMNG-5654
       (effectively addressed above)

Appendix 1 - Issues flagged for consideration post-modelVersion 4.0.0

This is not a perfect query as it includes issues that target behavioural changes outside the scope of modelVersion changes, but all the relevant issues should be a subset of this list

Jira
serverASF JIRA
columnskey,summary,type,description,status
maximumIssues60
jqlQueryfilter=12338619
serverId5aa69414-a9e9-3523-82ec-879b028fb15b