Cannot guarantee its current functionality, but this I used in one of my projects a few years ago. I did use separate gradle submodule for building Frontend and then separate module for Backend where I included Frontend as a JAR:
root gradle project -> frontend
-> backend
Frontend build.gradle (builds frontend JAR with /static/**)
apply plugin: "com.moowork.node"
apply plugin: 'java'
node {
version = '8.9.3'
download = true
}
def webResources = "$buildDir/web-resources/main"
sourceSets {
main {
output.dir(webResources, builtBy: 'buildWeb')
}
}
task webInstall(type: NpmTask) {
args = ['install']
}
task buildWeb(type: NpmTask) {
dependsOn webInstall
args = ['run', 'build']
}
build.dependsOn buildWeb
Backend build.gradle
apply plugin: 'spring-boot-gradle-plugin'
apply plugin: 'idea'
dependencies {
compile project(':frontend')
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…