[
https://issues.apache.org/jira/browse/SUREFIRE-1563?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596639#comment-16596639
]
Simone Bordet commented on SUREFIRE-1563:
-----------------------------------------
[~sor] adding a test module descriptor (i.e.
{{src/test/main/module-info.java}}) definitely chokes IntelliJ, we tried that
to work around this issue, so not keen to that.
Still, it is pretty incredible that a module that _is_ declared in the
module-path is not readable. Means that by looking at the command line alone,
you see all the dependencies listed in {{--module-path}} but you cannot
tell whether your application will work (while you are sure of this if they are
in the {{--class-path}}). To answer that you need to manually crack
open all the {{module-info.java}} and do the resolution in your head, or use
tools like {{--show-module-resolution}}. Interesting at best.
[~rfscholte] I personally won't mind {{--add-modules=ALL-MODULE-PATH}}
(there is already quite some hidden magic that Surefire does to run the tests
with respect to modules command line options), or just adding the list of
modules that are declared as {{requires static}}.
For the record, I guess Surefire can be configured in this way:
{code:xml}
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<argLine>@{argLine} --add-modules=ALL-MODULE-PATH</argLine>
</configuration>
</plugin>
</plugins>
<build>
{code}
[~sor] would you be able to test the above and see if it works?
> NoClassDefFoundError for JPMS modules with "require static"
> -----------------------------------------------------------
>
> Key: SUREFIRE-1563
> URL: https://issues.apache.org/jira/browse/SUREFIRE-1563
> Project: Maven Surefire
> Issue Type: Bug
> Components: Maven Surefire Plugin
> Affects Versions: 2.22.0
> Reporter: Simone Bordet
> Priority: Major
> Attachments: maven-jpms.tgz
>
>
> When a Maven module has a {{module-info.java}} that contains a {{requires
> static}}, Surefire throws {{NoClassDefFoundError}} when running the tests for
> that Maven module.
> If the dependency is declared only as {{required}} (no {{static}}), then the
> tests run fine.
> Attached a reproducible project.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)