[
https://issues.apache.org/jira/browse/MCOMPILER-364?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andre Tadeu de Carvalho updated MCOMPILER-364:
----------------------------------------------
Attachment: mcompiler-364-test-case.zip
> Multimodule project test problems with JPMS
> -------------------------------------------
>
> Key: MCOMPILER-364
> URL: https://issues.apache.org/jira/browse/MCOMPILER-364
> Project: Maven Compiler Plugin
> Issue Type: Bug
> Affects Versions: 3.8.0
> 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
(v7.6.3#76005)