Skip to content

Module Path

Jin Kwon edited this page Nov 17, 2026 · 1 revision

Module Path

The jar is a named module:

module com.github.jinahya.assertj.validation {
    requires transitive org.assertj.core;
    requires transitive jakarta.validation;
    exports com.github.jinahya.assertj.validation;
    opens com.github.jinahya.assertj.validation to org.assertj.core;
}

A consumer module needs only requires com.github.jinahya.assertj.validation; — AssertJ and Jakarta Validation come along transitively. The provider (e.g. Hibernate Validator) and its expression language are found as services or automatic modules, which nothing requires, so add them to the module graph, e.g. --add-modules ALL-MODULE-PATH.

Soft assertions

Everything works as on the class path except Soft Assertions proxy(..). Released AssertJ (3.x, 4.0.0-M1) generates the proxy class into this module's package. The module already opens the package to org.assertj.core, but AssertJ must also read this module, and on 3.27.7 the proxy needs an AssertJ package AssertJ does not export:

--add-reads org.assertj.core=com.github.jinahya.assertj.validation
--add-exports org.assertj.core/org.assertj.core.api.recursive.assertion=com.github.jinahya.assertj.validation

Neither option is needed without soft-assertion proxies.

Tested

.ci/jpms/run.sh compiles and runs a module-path consumer on Java 17 against the packaged jar, on every push, for AssertJ 3.27.7 and 4.0.0-M1 and both Jakarta Validation 3.0 and 3.1.

Clone this wiki locally