[Commented] (SUREFIRE-1811) Add resources to JPMS test module

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Commented] (SUREFIRE-1811) Add resources to JPMS test module

Piotr Zygielo (Jira)

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

Pavel_K commented on SUREFIRE-1811:

[~sor] I am trying to find a solution for IT tests and considering module-info.test. What I don't want to do is to create extra subprojects for IT tests as I have a modular maven projects (one parent + jpms modules) and to add there extra module for IT tests is not a good way.  I've considered your project here - [https://github.com/sormuras/testing-in-the-modular-world]  and have seen that you use nested project in src/it with its own pom.xml. However, my IDE (NetBeans 12) doesn't work with src/it/java and even can't imagine that there can be a nested maven project.


I thought about such solution -
 * unit tests on class path (no module-info in test/java),
 * module-info.java and module-info.test for IT tests in it/java
 * IT tests in separate packages in test/java (NB doesn't work with it/java)
 * patch it/java/module-info.java with packages from test/java using it/java/module-info.test

However, as soon as maven finds module-info in it/java it uses this module-info and for test/java. Can this be solved somehow?

> 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
>    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