error: option --module-path not allowed with target 1.8

error: option --module-path not allowed with target 1.8

When you set target 1.8, the flag --module-path seems to be added if a file `` is present in your project. I came across it when running a javadoc target via a Maven project.

As Java 8 does not support modules, it doesn't make sense. Depending on the tools you are using, it might be able to detect modules and not add the flag anymore. If your tool doesn't support it, you can delete the file:

find . -name '' -print -delete

Note though, that this can cause issues with building other packages (for example xxxx /[57,24] error: module not found: com.sun.xml.fastinfoset

So alternative option would be to set the build targets to Java 11 ( -Dtarget=11 ) or skip Javadoc build.

Note that SUSE has added a fix in xmvn-mojo that skips modular build. Red Hat implemented it in xmvn-mojo 4.2.0 :