Sharing common files between modules in a multi-module maven project

I have a Maven project with a parent-pom project and 2 maven-module projects in it. Both modules are java based that compile into jar files and each contains test files. These test files in both modules depend on common pages(files) for them to run.

The question I have is how to share these common files between modules without duplicating them in each module?

cc: @ibacher @janflowers @mksd @dkayiwa

Probably hosting these shared files in one of the module and being able to access them in the other module through imports in the test classes that use them.

Thanks @kdaud for this. My initial approach would be creating a sub module for example ui-tests and add it as sub module to qaframework. One challenge I came across is that, still these tests must depend on pages, implying that we might move all the pages into the sub module which we might not spend much time into it after all the end goal is to have selenium tests for now since There is a big hope to migrate all of them in a new BDD approach.

This was achieved perfectly in distro simply because distro added uitestframework as a dependency, so ui-tests submodule also depends on uitestframework which was easy for packages and imports to be accessed. Which is a different case here.

So ideally when you have only selenium tests in a submodule(ui-tests), they won’t be able to be accessed to the parent class, unless you make packages accessed. I tried this some time but tests would run simultaneously not in parallel which made it looking like poor design and made tests taking a long time to be executed by ci. cc @dkayiwa @ibacher could help us achieve this goal.

The question I have is how to share these common files between modules without duplicating them in each module?

The link below answered it all :grin:

1 Like

Yeah, that’s generally the idea. It’s why there’s a test-data sub-module of the FHIR2 project: the same test data files can be used for both unit and integration tests.

2 Likes