Executing Tests in Maven Multi Module projects

We have unit tests in common packages across multiple maven sub modules. Some tests rely on resources (such as message bundles) outside common packages.

When we execute tests via Run/Debug with the following configuration, the dependent resources outside common packages are not found, possibly because they are not compiled into output directory.
Has anyone come across / resolved such problems?  Many thanks.


Comment actions Permalink

How those resources are defined in the pom.xml?

Comment actions Permalink

Working directory should probably be $MODULE_DIR$. It is common problem with multi maven module projects.

Comment actions Permalink

Thanks for replies.The message bunlde is located in /src/main/resources/, which are compiled by maven fine, the path is not specially configured/specified in POM.xml.

I was not able to get it going with $MODULE_DIR$.

I have a wrapper MessageSource in BLL module, which is then Spring injected into multiple application modules.

// resourceName is typically "message"

public CustomMessageSource(String resourceName)


    ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();



The message bundles are located in application modules, is it possible that intelliJ is looking for the message bundle (messages.properties) in the class path of BLL module?

Everything works fine is I run the test with "In Single Module" options and use class path of application module, but it falls apart (unable to find message.properties) when I run with "In whole project" option.


Please sign in to leave a comment.