You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Robert Scholte (Jira)" <ji...@apache.org> on 2020/01/26 22:44:00 UTC

[jira] [Commented] (MJMOD-25) Multimodule project test problems with JPMS

    [ https://issues.apache.org/jira/browse/MJMOD-25?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17023953#comment-17023953 ] 

Robert Scholte commented on MJMOD-25:
-------------------------------------

Moving this issue to JMod plugin, because it looks like it is more related to that. IIRC the modulepath only accepts jars and named classes directories, not jmod files.

> Multimodule project test problems with JPMS
> -------------------------------------------
>
>                 Key: MJMOD-25
>                 URL: https://issues.apache.org/jira/browse/MJMOD-25
>             Project: Maven JMod Plugin
>          Issue Type: Bug
>    Affects Versions: 3.0.0-alpha-1
>            Reporter: Timo Heinonen
>            Priority: Critical
>         Attachments: mcompiler-364-test-case.zip
>
>
> I'm using multimodule maven project with JPMS and can't get all tests to work, because classes are not found. It's possible to run all tests successfully using java 8 and classpath, but with modulepath classes from module A's test sources can not access classes from module B's test sources. 
> Project structure:
>  *  Module A
>  ** src/main/java
>  *** Packages
>  **** a.foo
>  *** module-info.java (name: a, exports a.foo)
>  ** src/test/java
>  *** Packages
>  **** a.foo (includes tests for a.foo)
>  **** a.bar (includes helper classes needed by module B's integration tests)
>  *** module-info.java (name: a, exports a.bar)
>  * Module B
>  ** src/main/java
>  *** Packages
>  **** b.foo
>  *** module-info.java (name: b, requires a)
>  ** src/test/java
>  *** Packages
>  **** b.foo (includes tests for b.foo)
>  **** b.bar (includes integration tests that require access to module A's a.bar-package)
>  *** module-info.java (name: b, requires a)
> I have added additional module-info.java for test sources in both modules because a.bar and b.bar are additional packages that need to be exported (https://issues.apache.org/jira/browse/MCOMPILER-341). Basically tests in package b.bar depend on classes in a.bar and therefore module A's test classes should be available when running module B's tests. However, when tests are run from module B, modulepath contains two jars from module A: module compiled from sources and module compiled from test sources. Both modules have same module name and classes required by B's tests are not found. 
> I guess I could get all tests to work by moving all integraton tests from module B to separate test module, but I wouldn't like to do that because my project already has quite many modules. Also, I moved all classes from a.bar to a.test.bar package and renamed module created from module A's sources to a.test so that I could define requires directly to a.test in module B's test module. This fixed integration tests in module B, but broke unit tests in module A, because modules generated from module A (normal & test module) are not patched together anymore. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)