Before deploying the angular project in server we need to build angular project for production. We also need to change the routing path in index.html file from <base href=”/”> to <base href=”./”>
if it is not done then your project wouldn’t get loaded properly there will be some routing error saying 404 file not found.
ng build –prod
Above given command with extra option like –prod would generate the production build project bundle. Once the above command gets executed in the root directory of your project would appear a directory called dist. In which all the production build bundle of your project appears in it.
Once the dist directory is ready with your production built bundles. Just open the dist directory and open the command prompt type the following command to create the war file to deploy your project on apache tomcat server.
jar cvf dist.war .
Once the above jar commands gets executed. It would generate a dist.war file within the dist directory.