Saturday, September 20, 2014

Using your grunt project and/or bower components in your Spring application during development

I've been playing around with grunt, bower, and yo lately. It's pretty simple creating a build step to copy the dist/ output into your webjar, or war for production, but I wanted an easy way to bring in my javascript into my Spring app during development. Nothing bugs me more than having to perform a copy or rebuild step just to see my changes in the application during dev.

So I came up with this solution. Assuming your IDE is running your run configuration in your source root, you can create Spring resource handlers relative to that directory. The gist below shows.