문제

I have a few weeks before the next project & i'm looking/wanting to streamline our development process to give the UX & Devs guys the shortest lead time to change validation (e.g. 10 seconds for a Java change/1 second for UX/JS changes).

Basically, I want what John Lindquist shows in this video (RT feedback with webstorm & the Angular todo list example in 3 minutes) but I with Tomcat & Spring.

Ive been researching/playing this for the last few days with our stack (Tomcat8,Intellij13, Spring4, Angular) and I am just not 'getting it' so think it is my lack of knowledge in this area and i'm missing something (hence the SO question).

What I have achieved to date for UX Guys

Grunt (using node) to serve up the 'static resources'(JS/SCSS/Templates) and livereload to refresh chrome - this is very good and very close to what i want (RT feeback from SCSS/JS/HTML changes) but the big problem is that node is serving the static resources and not TC so with Cross Origin Policies (solved via this and this )- rebuilds in intellij become messy with grunt involved - looked at SCSS compiles with file watchers but it is not gelling) - in short i did not get grunt servicing static & TC the REST API working in harmony. Another option was this guy updates the TC resources with grunt when the file changes but just don't want to go there.

This leads me back to file watchers, jetbrains live edit (what the web storm video shows) and intellij and again, i'm close when it comes to static content as intellij can update the resources on TC on frame deactivation but (and a big BUT) this is NOT real time and when you change resource structure, you need to refresh the page however we are working on a SPA which loses context on refresh which slows the guys down as have to reply sequences to get back to where the change happened and also when using intellij they have to 'frame de-activate' to get the changes pushed to TC (they are on dual monitors so to tab off intellij is the same as pushing a button to deploy the changes )

The best to date is grunt and accept the same origin issues for development but am I missing something for the UX guys?

What I have achieved to date for Dev Guys

Before we start, can't afford jrebel and haven't got Spring Loaded working with intellij and tomcat (yet).

at this stage simply having TC refreshed by intellij with classes change and restart when bean definitions/method structure changes. Bad I know but 'it is what we are use to'

Looking at spring boot - promising but ideally would like not to give the configuration freedom away but it does give live updates on the server I believe.

Grails is out at the moment so can't benefit there.

I know Play allows some real time updates but again, haven't looked at this in detail and a big shift from the current stack.

Summary

On the development side will likely stick to Live Edit and accept the refresh/deactivation issue so we can't 'achieve' what John Lindquist shows in Webstorm, i.e. real time updates when resources changes when using Tomcat/Intellij/Chrome - or at least 'I don't know' how to achieve this?

Server side - i'm still working on this, going to continue to look at spring loaded and intellij integration then look at jrebel and see what budget, if any, we can get but in the meantime is there any alternatives as I see the node/ruby/grails guys getting it all so i believe it must be me and i'm missing the best setup to get super fast feedback from our code changes when using Tomcat & Spring?

도움이 되었습니까?

해결책

In Short, yes it is possible & have achieved what I set out to achieve - that was all developmental changes in a Java EE platform (including JS/SCSS Changes and Spring/Java Changes) to happen in 'real time' (5/10 seconds server, 2 seconds ux). I have recorded a little video showing it all in action (please excuse the lack of dramatics)..

Stack:

  • AngularJS

  • Grunt -serving up static pages with an http proxy to /service context calls. The proxy is needed for 2 reasons - 1 is to get around the Cross origin issues & 2 - so that real time static resources changes (HTML/JS/SCSS) are shown in Chrome - you can't do this with tomcat as the resources are copied to the web-app folder in TC and not being served directly from source (Intellij can redeploy on frame deactivation but that doesn't work well and it doesn't allow for instant changes to be reflected in Chrome)..

  • Grunt monitors SCSS changes (I believe you could use file watchers in intellij though but have grunt serving the static content)

  • Live Edit updates Chrome on the fly.

  • JRebel for Spring/Server side changes to Tomcat (licence required for commercial use)

The subtle but important thing is what Grunt is doing..

다른 팁

I think this is a simpler alternative to Ian's solution:

Structure the application in three parts:

  • REST services (src/main/java) and
  • Web source files (src/web, don't include them in the final war)
  • Static files produced by grunt (src/web/dist, and include them in final war at /)

Configure CORS filter (which you need anyway for REST services) [1]

Now the kicker:

  • Start tomcat (as usual)
  • Start your angularjs website from src/web (using IntelliJ it's just Debug index.html)
  • Done -- all your edits in source html/js files are reflected in next browser refresh (or use grunt plugin to make it even more "live")

[1] https://github.com/swagger-api/swagger-core/wiki/CORS

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top