Skip to content

[MNG-8537] Keep Maven Namespace the same #10952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open

[MNG-8537] Keep Maven Namespace the same #10952

wants to merge 21 commits into from

Conversation

elharo
Copy link
Contributor

@elharo elharo commented Jul 19, 2025

Namespaces and model versions are not the same thing and do not serve the same purpose. This PR has two related effects:

  1. The namespace for all pom.xml files is now http://maven.apache.org/POM/4.0.0
  2. Namespaces are not used to infer model versions. That's the job of the modelVersion element

Fixing this opens up Maven to the large and valuable XML toolchain. It makes it much easier for developers to analyze, store, and manipulate pom.xml files from a variety of languages without depending on complex Maven APIs and tooling. It decouples the poms from the Java source code. It is no longer necessary to use Maven libraries to process poms.

On the Maven side, it removes a roadblock to using standard XML parsers like Xerces instead of maintaining a separate custom XML parser. The more we can fit into the standard toolchains, the easier development becomes.

fixes #10692

@elharo elharo changed the title Revert Namespace [MNG-8537] Revert Namespace Jul 19, 2025
@elharo elharo marked this pull request as ready for review July 20, 2025 10:58
@elharo elharo changed the title [MNG-8537] Revert Namespace [MNG-8537] Keep Maven Namespace the same Jul 20, 2025
@elharo elharo requested a review from Bukama July 20, 2025 11:24
Copy link
Contributor

@gnodet gnodet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I don't disagree with the change, I think this is not doable between rc-4 and ga. This is a major breaking change, so it should have been planned from the beginning when discussing 4.0, not at the last minute.
I'd defer that for 5.0.

@elharo
Copy link
Contributor Author

elharo commented Jul 20, 2025

I've been pushing this for a long time, and the longer we wait the harder it gets to do. I'm not sure it can be done in 5.0

@gnodet
Copy link
Contributor

gnodet commented Jul 20, 2025

I've been pushing this for a long time, and the longer we wait the harder it gets to do. I'm not sure it can be done in 5.0

A few months, I know (January IIRC), but 4.0 was already on track since a long time IIRC (we just released RC-2).

Would you bring that to dev list ? we'll need to involve the whole community to choose between those two options.
My point is that we already created a stabilisation branch for 4.0.0, while master is now targeting 4.1.0 already.
This would also break any POMs that have been already been deployed on central with a 4.1.0 namespace.

Fwiw, the PR is incomplete. At first glance, the DefaultModelBuilder and ConsumerPomArtifactTransformer would require some modifications (and tests, since they should somehow fail with your changes but they're not).

@elharo
Copy link
Contributor Author

elharo commented Jul 21, 2025

Nothing should be deployed with the 4.0 namespace as it hasn't been released yet. If something is, I can live with that breakage. Of course, once 4.0 is released, it becomes far more damaging to change it.

@elharo
Copy link
Contributor Author

elharo commented Jul 21, 2025

FYI, a quick check of my inbox shows I've been raising red flags on this since at least 2019.

@michael-o michael-o removed their request for review August 2, 2025 21:37
@@ -417,7 +399,7 @@ void shouldHandleMissingModelVersion() throws Exception {
@ValueSource(
strings = {
"http://maven.apache.org/POM/4.0.0",
"http://maven.apache.org/POM/4.1.0",
"http://maven.apache.org/POM/4.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate of 401?

@@ -417,7 +399,7 @@ void shouldHandleMissingModelVersion() throws Exception {
@ValueSource(
strings = {
"http://maven.apache.org/POM/4.0.0",
"http://maven.apache.org/POM/4.1.0",
"http://maven.apache.org/POM/4.0.0",
"https://maven.apache.org/POM/4.0.0",
"https://maven.apache.org/POM/4.1.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here is also 4.1

/** Maven 4.1.0 namespace URI */
public static final String MAVEN_4_1_0_NAMESPACE = "http://maven.apache.org/POM/4.1.0";
/** Maven namespace URI */
public static final String MAVEN_4_1_0_NAMESPACE = "http://maven.apache.org/POM/4.0.0";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so no need for this const

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MNG-8537] Maven 4 namespace should not change
3 participants