Languages
[Edit]
EN

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

9 points
Created by:
AnnLen
1771

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:

dist/our_project_name/

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:
spring_project_name/src/main/resources/static

Run:

mvn install

in target dir we will get jar:
spring_project_name.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 application.properties eg:
server.port=8081

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 👍