JPMS / Jigsaw Support in XmlBeans 4.0
Repackaging the schema files
The schema generation has been modified in XmlBeans 4.0. Before the default path for the schemas was in schemaorg_apache_xmlbeans and the SchemaTypeSystem was fixed on the subdirectory structure.
With XmlBeans 4.0 this is now a bit more dynamic. The default generation will be in the package org.apache.xmlbeans.metadata, which should be adapted to the project package name.
This can be achieved by using the repackage options. Take the below example which is from the Apache POI build. The repackage option is changing the package structure from org.apache.xmlbeans.metadata to org.apache.poi.schemas.ooxml.
The schema files are relatively addressed by the TypeSystemHolder instance under <repackage name>/system/<typesystemname> (e.g. /org/apache/poi/schemas/ooxml/system/ooxml)
Manual generation of module-info.java
The generation of the module-info.java isn't yet supported, hence you need to provide a module-info.java. In the case of Apache POI the module-info is injected as part of a multi-release configuration.
Depending on the used JDK version, specifically for Java 9 and 10 you might need to include xml-apis. More recent Java version work with the following dependency set:
Currently it's necessary to open the schema classes module because of the dynamically loaded *.xsb files. This limitation might be obsolete in future versions of XmlBeans.