Angular + Spring boot部署为战争

问题描述 投票:0回答:1

我有两个项目,一个是Angular Project(前端应用程序),另一个是Spring boot(Rest Api)。

现在我想为这两个项目生成一个可运行的war / jar文件,在运行“java -jar”命令后,它应该是Angular模块以及spring boot模块

node.js spring angular maven spring-boot
1个回答
0
投票

在后端构建过程中,在构建前端模块之后,您可以将前端构建目录中的内容复制到${project.projectDir}/src/main/resources/static/中,这样两个模块就可以打包到一个jar中。以下是使用Gradle的示例:

task moveFrontendToResources(type: Copy) {
    from "../frontend/build/"
    into "${project.projectDir}/src/main/resources/static/"
}

moveFrontendToResources.dependsOn(':frontend:bundle')
processResources.dependsOn(moveFrontendToResources)
© www.soinside.com 2019 - 2024. All rights reserved.