Question Details

No question body available.

Tags

java maven maven-3 module-info java-25

Answers (2)

Accepted Answer Available
Accepted Answer
January 12, 2026 Score: 5 Rep: 10,089 Quality: Expert Completeness: 80%

I've been testing this myself, also with other plugin versions, but I get the same error. Adding -X -e doesn't show much more, apart from this:

Caused by: com.thoughtworks.qdox.parser.ParseException: syntax error @[3,15] in file:/C:/tmp/tmp/src/main/java/dev/MyList.java.

It seems that Maven is not just delegating to the Java compiler but doing its own parsing, and that is maybe not compatible with Java 25 yet...

I found this... https://github.com/paul-hammant/qdox/issues/299. I'm afraid you'll have to wait until that is resolved, and used in the Maven compiler plugin. Or, add an explicit dependency to the compiler plugin definition:

    

org.apache.maven.plugins maven-compiler-plugin 3.14.1

25

com.thoughtworks.qdox qdox version-with-fix

January 12, 2026 Score: 1 Rep: 107,363 Quality: Medium Completeness: 80%

It looks like you've misjudged where the error is.

The maven message isn't complaining about your module-info.java file. It's complaining about your MyList.java file; in particular, the import module statement, which is new in JDK25.

Conclusion: Most likely your maven is compiling with a --release below 25, and/or using a javac from a JDK below v25.

Various tools you wouldn't immediately think of also scan source files even if only for import statements, and quite a few aren't yet capable of parsing module imports.

Note that many style guides disallow star imports. Naturally then there are only 2 options:

  • The style guide is totally wrong. As in, they ran headlong into a dead end and need to be completely abolished, the very core foundations are broken.
  • module imports are not allowed 1.

And it's going to be the second one. This isn't necessarily a clash between style guides and OpenJDK: Module imports are a way to avoid having to 'hardcode' something: The reason they exist is solely to support the notion that your first steps in java should be as simple as opening a text file and writing for example:

void main() {
  var list = new ArrayList();
}

and indeed, in JDK25, it really is that simple. That actually compiles. A bunch of sub-JEPs have been implemented to make the above work, and one of them is... module imports.

So, leave module imports for learning java, toy projects, and one-off command line scripts.


[1] Or not. Most style guides disallow braceless if and for but allow braceless lambdas which is extremely inconsistent; in fact, the general stated reasons for disallowing braceless if/for are worse for lambdas, not better. And yet, no style guides seem to be interested in confronting their own inconsistencies in this regard. In the same vein, possibly style guides will end up stating that star imports are rarely acceptable but module imports are no problem, without explaining what kind of mental gymnastics were involved. Style guides are more or less by definition catering to subjective senses.