Angular - build angular project for production (npm package prod) with spring boot app

9 points
Created by:

1. Build Angular project for production

From the root of our our_project_name run command:

ng build --prod

angular will output the results of the build to:


2. Build package angular dist with spring boot

Copy the dist/our_project_name/
Copy only the content of 'dist/our_project_name/' without dir 'our_project_name'

to spring project under path:


mvn install

in target dir we will get jar:

Run jar from cmd:

java -jar spring_project_name.jar

- and we will have frontend served from spring project
the application port is the same as specified in eg:

Default spring boot port if not specified is 8080

Checkout latest findings & news:

Checkout latest questions:

Checkout latest wiki articles:

Hey 👋
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.
Rockstar community members
Thank you for great work 👍