Languages
[Edit]
EN

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

11 points
Created by:
isherwood
599

In this short article, we would like to show how in a proper way configure IntelliJ Ultimate 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:

2. set Working directory as: $MODULE_WORKING_DIR$

 

1. Problem overview

Edit

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.

       

2. Problem solution

Edit

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

Screenshot:

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.
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
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.

❤️💻 🙂

Join