SpringBoot and Webpack dev server

(Eric Traub) #1

I’m trying to setup a gradle build that will run execute bootRun from the ‘spring-boot’ plugin and launch a Webpack dev server. I can run SpringBoot with gradle and run webpack server from the command-line, but what I’d really like is to have one gradle task that can run both. (For those not familiar with webpack dev-server it’s a dev tool that manages transpiling of javascript files, automatically updating the browser when source files changes and other features).

Am I correct that the only way to do this is to setup 2 Gradle projects one for SpringBoot and one for WebPack? This seems like overkill but I may just be intimidated by the fact I haven’t had to setup a multi-project build before.

I realize I can setup a webpack as a dependent task of Gradle bootRun but this doesn’t allow hot reloading which is a feature I really like.

Environment: I’m using Gradle 3.5.1, SpringBoot 1.5 and webpack-dev-server 2.9.2

Any help is appreciated I’m fairly new to Gradle.