apache / apache/netbeans

maven 4 modelVersion 4.1.0 is rejected by NetBeans even on maven 4

Open
#8,632 1 comment 0 reactions 0 assignees View on GitHub
kind:bug Maven
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 26

### What happened

When I try to use a maven file for maven 4, the modelVersion is rejected by NetBeans.

It appears as if the rejection stems from a lower Maven version, like the bundled one.

![Image](https://github.com/user-attachments/assets/7b5bdbd2-1771-4f36-a989-33bb7eaf92b2)

My assumption stems from the fact that a lower maven version reports with the same message.

```shell
hom@twohundred:~/homberghp/mvnjpms/jmpsmaven
$ mvn -version
Apache Maven 3.9.10 (5f519b97e944483d878815739f519b2eade0a91d)
Maven home: /usr/share/maven
Java version: 21.0.7, vendor: Eclipse Adoptium, runtime: /usr/lib/jvm/jdk-21.0.7+6
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "6.11.0-29-generic", arch: "amd64", family: "unix"
hom@twohundred:~/homberghp/mvnjpms/jmpsmaven
$ mvn validate
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] 'modelVersion' of '4.1.0' is newer than the versions supported by this version of Maven: [4.0.0]. Building this project requires a newer version of Maven. @ line 4, column 19
@
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR] The project com.mycompany:jmpsmaven:1.0-SNAPSHOT (/home/hom/homberghp/mvnjpms/jmpsmaven/pom.xml) has 1 error
[ERROR] 'modelVersion' of '4.1.0' is newer than the versions supported by this version of Maven: [4.0.0]. Building this project requires a newer version of Maven. @ line 4, column 19
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
```

It looks as if the validation of the maven file is done by some other agent than the selected maven version.

### Language / Project Type / NetBeans Component

java maven maven 4

### How to reproduce

Create a project and adapt lines 2, 3, and 4 to read like below.
Make maven 4 the selected maven version in Tools -> Options -> Java -> Maven -> Version

```xml

4.1.0
com.mycompany
jmpsmaven
1.0-SNAPSHOT
jar

UTF-8
21
com.mycompany.jmpsmaven.Jmpsmaven

```

So everywhere you see 4.0.0 in those line replace by 4.1.0

Just having the file open in the editor already results in the flagged error.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Ubuntu 24.04

### JDK

JDK 21

### Apache NetBeans packaging

Apache NetBeans provided installer, Apache NetBeans binary zip

### Anything else

Occurs always.
I am trying to cooperate with a Maven maintainer to up the JPMS game for both Maven and NetBeans.

Maven4 accepts the pom file without problems.
```shell
$ mvn4 validate
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------< com.mycompany:jmpsmaven >------------------------------------------
[INFO] Building jmpsmaven 1.0-SNAPSHOT
[INFO] from pom.xml
[INFO] ----------------------------------------------------[ jar ]----------------------------------------------------
[INFO] ---------------------------------------------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ---------------------------------------------------------------------------------------------------------------
[INFO] Total time: 0.127 s
[INFO] Finished at: 2025-07-03T15:24:00+02:00
[INFO] ---------------------------------------------------------------------------------------------------------------
```

Currently, this issue disables advancement in more modern maven usage.

### Are you willing to submit a pull request?

Yes

Contributor guide

Open the contributing guide

Research direction

Reproduce the report with the supplied pom.xml, modelVersion 4.1.0, and Maven 4 selected under Tools → Options → Java → Maven → Version. Start by tracing the NetBeans Maven model validation used when the POM is open; done means the editor accepts the 4.1.0 model without flagging the modelVersion as unsupported.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.