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

Christian Stein commented on SUREFIRE-1811:
-------------------------------------------

An application using multiple module layers can use the same module in multiple 
versions. See [https://github.com/moditect/layrry] for an example.

Like Gili wrote, using dedicated test modules (not sharing names with main 
modules) is the best way to ensure your modular API is working as expected. Let 
your test modules be the first clients of your main modules.

For in-module testing, either resort to the class path like it is 1999 or patch 
either main sources/classes into test modules or vice-versa. Nothing changed 
here. Choosing the same name for a main and a test module is only a hint for 
the build framework to apply some sort of patching. Perhaps that train left the 
station for Surefire 3.x - an interesting discussion (not replacing the Apache 
Maven mailing lists!) about Better Java Module System support for Maven 4" was 
started at: https://github.com/OpenElements/maven-support-care/discussions/11

> Add resources to JPMS test module
> ---------------------------------
>
>                 Key: SUREFIRE-1811
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1811
>             Project: Maven Surefire
>          Issue Type: New Feature
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 3.0.0-M5
>            Reporter: Pavel_K
>            Priority: Major
>
> I am testing version 3.0.0-M5 with two module-info in one project - one main 
> and one for test. My test project is here 
> https://github.com/PashaTurok/hibernate-h2-test4 . The problem is with 
> resources. For example, I have  src/main/resources/META-INF/persistence.xml 
> file that is not copied to test module. Because of this it is not possible to 
> find resource in test module and it is necessary to use something like this 
> https://github.com/PashaTurok/hibernate-h2-test4/blob/292e2e683ad72487cbf8d2e5a35dde0d9255001a/src/test/java/com/foo/hibernate/h2/test4/TestIT.java#L72
>  . 
> In target/test-classes/META-INF/jpms.args I see:
> {code:java}
> --patch-module
> my.project=/home/..../hibernate-h2-test4/src/main/java, 
> /home/.../hibernate-h2-test4/target/generated-sources/annotations
> {code}
> As I understand test module will NOT contain resources from the module under 
> test? I mean that test module will NOT contain 
> /home/..../hibernate-h2-test4/src/main/resources? 
> That's why I suggest to include src/main/resources in test module.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to