apache / apache/maven-surefire

[SUREFIRE-1811] Add resources to JPMS test module

Open
#3,040 72 comments 0 reactions 0 assignees View on GitHub
enhancement priority:major
Dominant language
Java
Stars
461
Forks
588
Avg merge
1d 8h
Merged PRs (30d)
19

Description

**[Pavel_K](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=pavel_k)** opened **[SUREFIRE-1811](https://issues.apache.org/jira/browse/SUREFIRE-1811?redirect=false)** and commented

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:

```java
--patch-module
my.project=/home/..../hibernate-h2-test4/src/main/java, /home/.../hibernate-h2-test4/target/generated-sources/annotations
```

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.

---

**Affects:** 3.0.0-M5

0 votes, 5 watchers

Contributor guide

Open the contributing guide

Research direction

Inspect how target/test-classes/META-INF/jpms.args is produced and compare it with src/main/resources/META-INF/persistence.xml. Reproduce the issue with the linked hibernate-h2-test4 project; done means the main module's resources are available to the JPMS test module without the workaround in TestIT.java.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.