I made a small Angular application and I want to add it into a deployable war which should run in Tomcat 9. I executed ng build --prod in order to generate the files in the dist folder. The content of the dist folder:

enter image description here

In the POM of the Spring module which generates the WAR I added the following plugin in order to copy the dist folder into the target folder of the Spring Module: enter image description here

I have an empty spring Controller class. So, by default, the index.html file should be rendered (that's what I read)

enter image description here

The WAR is then deployed in Tomcat, and when I make a GET request "http://localhost:8080/chartinvest-web" , I get a 404 response in Postman. Thus, the index.htm file is not found/rendered.

enter image description here

1 Answers

Community On

Try building with your context path.

ng build --prod --base-href "/chartinvest-web/" --deploy-url "/chartinvest-web/"