https://kotlinlang.org logo
#gradle
Title
# gradle
r

Rasmus

03/11/2023, 10:10 AM
I noticed that there's no built in way to copy test resources from one submodule to a submodule that depends on it. What is the recommended way to include this file:
core/src/test/resources/logback-test.xml
? To the relevant build directory of all of these submodules that depend on the core module:
Copy code
submodule1/build/resources/test
submodule2/build/resources/test
...
v

Vampire

03/11/2023, 10:46 AM
Sounds like you are after the java test fixtures plugin: https://docs.gradle.org/current/userguide/java_testing.html#sec:java_test_fixtures
v

vladimirsitnikov

03/11/2023, 10:58 AM
If you want to reuse classes and resources for tests, you might want extracting them as a standalone -testkit module, and use it as dependency
v

Vampire

03/11/2023, 1:07 PM
What would be the benefit over using the java test fixtures plugin?
v

vladimirsitnikov

03/11/2023, 1:07 PM
-testkit could be published and consumed by third-party code
v

Vampire

03/11/2023, 1:10 PM
No difference there.
The plugin defines a feature variant that you can choose to publish
r

Rasmus

03/12/2023, 9:01 AM
Oooh, thanks that looks perfect to me.
7 Views