Swastik
Swastik

Reputation: 283

Angular Spring Boot Packaging Issue

I have the current project structure for a spring boot angular project

+--app-ui
|--+--src
|--+--dist
|--app-backend
|--+--src
|--+--+--main
|--+--+--+--resources
|--+--+--+--+--static
|--+--+--+--java

app-ui contains the angular 6 code app backend contains the spring boot code. Now everytime I build app-ui i want the dist folder contents in app-ui to be copied to app-backend/src/main/resources/static

In order to do that I have added these lines in the angular build

"predeploy": "rimraf ../app-backend/src/main/resources/static/ && mkdirp ../app-backend/src/main/resources/static",

"deploy": "copyfiles -f dist/** ../app-backend/src/main/resources/static/

This creates the static folder inside Spring boot project but it doesn't copy the files and folders inside dist folder.

Upvotes: 0

Views: 1152

Answers (2)

anonymous-explorer
anonymous-explorer

Reputation: 415

I tried this way for integrating my angular app with spring-boot so the static code is atleast in spring boot app path. But I still couldn't see user interface when my spring app is running on port 8080.
Not sure if I'm missing something but majority of my frontend code that is; ng components .ts, .html and .css files are in frontend/src dir, which I didn't move anywhere. Any suggestions?

Upvotes: 0

Wrokar
Wrokar

Reputation: 963

If you are using AngularCLI (with an angular.json file), simply change the outputPath property to specify your desired static directory.

"outputPath": "../app-backend/src/main/resources/static"

Upvotes: 3

Related Questions