Spring Boot - multi module maven doesn't see resources and JSP files under IntelliJ

8 points
Created by:

In this short article, we would like to show how in a proper way configure IntelliJ IDE when we use multi-module maven project and we have a problem with access to resources and *.jsp files in Spring Boot Application.

Quick solution:

Set working directory for run module:

1. go to Run/Debug Configurations:

Run -> Edit Configurations... -> Spring Boot -> [my spring boot application] -> Configuration -> Environment

2. set Working directory as: $MODULE_WORKING_DIR$


1. Problem overview

When we use maven modules in the project and the application is run from:

  • the command line, everything works well
    Note: we run java -jar /path/to/application.jar
  • IntelliJ¬†IDE¬†everything works well but it is impossible to:
    • use¬†*.jsp views with controllers that are needed when we use Tomcat as a server,
    • read¬†resources, e.g.
      ResourceLoader resourceLoader;
      Resource someResource = resourceLoader.getResource("some_resource.txt");


2. Problem solution

It is necessary to select the correct working directory for the run module.

Simple steps:

  1. click to Run -> Edit Configurations... menu,
  2. go to Spring Boot -> [my spring boot application] section in the left tree,
  3. go to Configuration tab,
  4. go to Environment configuration,
  5. set Working directory as $MODULE_WORKING_DIR$,
  6. accept all changes


Working directory set to $MODULE_WORKING_DIR$ to access resources in maven modules under IntelliJ.
Working directory set to $MODULE_WORKING_DIR$ to access resources in maven modules under IntelliJ.
Native Advertising
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

‚̧ԳŹūüíĽ ūüôā