native-build-tools icon indicating copy to clipboard operation
native-build-tools copied to clipboard

Tests fail to access resources if tests are run from parent module

Open dzou opened this issue 3 years ago • 1 comments

I think there may be an issue with how the native-maven-plugin runs tests that accesses resources from src/test/resources; the behavior appears different from how the surefire-plugin resolves these paths.

When I run certain tests from the parent module that use resources using the maven-surefire-plugin (in JVM mode), these tests will pass. However, when the same tests are run with the native-maven-plugin (using mvn test -Pnative) they will fail.

I have made a reproducer here to describe the issue: https://github.com/dzou/native-plugin-working-dir-repro

I don't believe this is a resources-config.json issue because the tests will pass in native mode if it is run from the child-module directly. I have also tried adding a resources-config.json but it has no effect.

dzou avatar Dec 02 '21 01:12 dzou

Clarifying a point - I don't think the issue is limited to "resources" but rather any relative path used to reference files in a test of a child module.

dzou avatar Dec 02 '21 17:12 dzou