build.gradle에서 npm run build 수행방법:


plugins {
id "com.moowork.node" version "1.2.0"
}
apply plugin: 'com.moowork.node'
task npmBuild(type: NpmTask) {
args = ['run-script','build']
}
build.dependsOn npmBuild



그리고, jar하면서 react.js의 결과파일을 static으로 넣는 방법은

 web-frontend 프로젝트를 별도로 만들고, (위의 build.gradle작업은 여기서 하고)


메인 spring-boot-webapp 프로젝트의 build.gradle에서   아래와 같이  의도적으로 build밑에껄 복사해준다.

jar {
//blabla
from {
configurations.compile.collect {it.isDirectory()? it: zipTree(it)}
}
into('static') {
from('../web-frontend/build')
}
}


Posted by yongary
,