Bukama commented on code in PR #598: URL: https://github.com/apache/maven-site/pull/598#discussion_r1915418100
########## content/markdown/whatsnewinmaven4.md: ########## @@ -0,0 +1,474 @@ +# What's New in Maven 4? + +Maven is over 20 years old and is one of the most used build tools in the Java world. +Throughout the years, one important rule has been maintaining the highest backward compatibility possible, especially +with its [POM-schema with Model version 4.0.0][2], used not only for the build itself but also by consumers. +This made Maven more than a tool; it became a whole ecosystem with many dependencies on the POM, especially the Maven +Central repository, other build tools, and IDEs. +But this stable schema comes at a price - the lack of flexibility. + +> "With the Maven build schema preserved in amber, we can’t evolve much: we’ll stay forever with Maven 3 minor releases, +> unable to implement improvements that we imagine will require seriously updating the POM schema…" +> — <cite>[Hervé Boutemy (in Javaadvent 2021)][1]</cite> + +Maven 4 will prepare for changes which are impossible nowadays, like a completely new build schema. + +Another pain point of Maven 3 is a codebase with a lot of deprecated, convoluted, non-performant, and duplicated code +which costs the volunteers who maintain Maven a lot of time. +This not only means that the Maven codebase contains old Java code that can be optimized nowadays but also old +dependencies and poor API design of its own APIs, especially for Maven plugins. +Therefore, Maven 4 will also be a maintenance release. + +This article presents and explains major changes brought by Maven 4, grouped into several topics. + +## POM Changes + +### Build-POM and Consumer-POM + +As written in the introduction, Model version 4.0.0 is used not only for the build but also by consumers of the +artifact. +However, several contents of the POM are only necessary for the build while others, like the dependencies, are also +needed by the consumer. +Maven 4 will therefore differentiate between a "Build-POM" and a "Consumer-POM". +As the names suggest, the "Build-POM" will contain all information needed to build the artifact, e.g., used plugins and +their configuration, while the "Consumer-POM", which is created during the Maven build, will not contain those. +This POM will only keep what is really needed to use the artifact, e.g., dependency information. + +**Note**: See below for a comparison of the content of both POMs. + +### Model version 4.1.0 + +With now having two types of POM, Maven 4 can already make additions to the Build-POM as it will only be used by Maven ( +and of course IDEs). +Therefore, with Maven 4, a new Model version 4.1.0 is introduced. +This version introduces some new elements and attributes, while others are marked as deprecated. +To not break the ecosystem, this version is only available for the Build-POM, while the Consumer-POM will still use +version 4.0.0. +This means Maven will generate the Consumer-POM during the build. + +**Note**: Maven 4 will of course continue to build your model version 4.0.0 project! +There is no need to update your POMs to 4.1.0 as long as you don't want to make use of the new features. +But as with every software update - it's suggested to update them to 4.1.0, e.g., to avoid problems when deprecated +features are removed in future updates. + +### Modules are now subprojects + +From the early days of Maven 1 until today, all build information is stored in the POM, short for "Project Object +Model". +Together with build folders and other files, the wording "Maven project" is used. Review Comment: > This all need a better explanation with examples. Please lay out what you mean. Shall I write/show an example of a Maven project's folder? This is done the users guide (https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html). And I don't think we need to explain this to someone who's interesting in information about the changes between Maven 3 and 4. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org