摇篮弹簧和角度定制 [英] Gradle spring and angular custom build

查看:74
本文介绍了摇篮弹簧和角度定制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的.我有一个弹簧靴和棱角项目.我正在使用com.moowork.node构建角度项目.我需要2个创建单独的任务,第一个任务是制造弹簧和角形并生产胖子,第二个任务是仅构建弹簧靴而没有角形项目我尝试过

I'm new to gradle. I have a spring boot and angular project. I'm using com.moowork.node to build angular project. I need 2 to create separate tasks the first one to build spring and angular and produce fat jar, and second task to only build spring boot without angular project I tried

plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'java'
}
apply plugin: 'io.spring.dependency-management'

task appNpmInstall(type: NpmTask) {
    args = ['install']
}

task appNpmBuild(type: NpmTask) {
    args = ['run', 'build']
}

task copyWebApp {
    doLast {
        copy {
            from 'dist' into '../build/resources/main/static'
        }
    }
}

appNpmBuild.dependsOn appNpmInstall
copyWebApp.dependsOn appNpmBuild

然后

task("buildFull") {
  dependsOn('frontend:copyWebApp')
  dependsOn build
}

但是这会在没有弹簧启动的情况下构建前端应用程序,并且不会生产Jar

But this build the frontend app without spring boot and not product the Jar

推荐答案

一个建议,请避免使用胖子jar来存放angular的dist文件夹.运行胖罐(在端口8081上说).只需将angular的dist文件夹保留在任何Web服务器上(例如Nginx服务器,例如端口8080).将有角度的应用程序指向运行在8081上的REST服务.

A suggestion, plz avoid the fat jar to have the angular's dist folder. Run the fat jar ( say on port 8081). Simply keep the angular's dist folder on any web server (for e.g. Nginx server, say port 8080). Have the angular app point to REST services running on 8081.

这篇关于摇篮弹簧和角度定制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆