'Spring jar can't see resources

I have Spring Boot web app which work on IntelliJ. I build jar file from maven. Jar starts but css, js and img "blocked" in Chrome console show error 404, Firefox show Error 403. I unpack jar to check resouces folders and they OK. How solve the problem?

[enter image description here



Solution 1:[1]

You probably didn't get those files with you in that package. How did you create the .jar file?

  1. I rightclick on my pom.xml file, then choose "Run as -> Mavenbuild..."

  2. I write "package" (as "Goals:" value, but the cursor just goes there for me automatically).

  3. Click run.

  4. It should now compile a complete .jar file in the "target" direcetory of your app.

Sometimes this will fail the first time i try to build my package (for some reason unknown to me) and then succeed the second time so before you give up, try it 2-3 times.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1