After some early snag, I followed a suggestion from Henrik Paul in the comments to put the JS files in the src/main/resources folder, and i got it working, sort of. There’s this really annoying thing though: Changes to the JS Connector (*.js) source files will not get picked up by Netbeans/Maven/Tomcat unless i do a full ‘clean and build project’, which takes some time because it involves a widgetset compilation.
Is this a bug, or did i miss something?
Thanks in advance.
Something REALLY weird is going on, now i cannot make the app to pick up changes in my connector js even after a full “clean&build project” (which included a widgetset compilation phase) and redeploy.
The only way i can make it recognize the latest connector js changes is when i changed the project name and moved it to a new location (context path?), and THEN it will pick up the change. It’s almost as if the js is cached somewhere. This is happening on firefox/chrome/opera so i don’t think this is a browser cache issue.
I’m attaching the maven project just in case anyone wants to give this a shot.
Open the maven project, change the application server, clean&build.
Run it once (notice the output)
Locate the JsLabelConnector.js file (under src/main/resources)
Modify the js file, from
e.innerHTML = this.getState().xhtml;
//to something random, like:
e.innerHTML = this.getState().xhtml + "<H1>WHY DOESN'T THIS SHOW UP!!</H1>";
Save and redeploy.
After this point, no matter what i do to the JS file, the app will ALWAYS show the original version. Very baffling.
Anyone ever have these symptoms?
I’m not even sure whether this is a vaadin issue, a tomcat issue, a netbeans issue, or a maven issue…
You are using Maven as a project infrastructure. So try to run the project without NetBeans from the command line.
And check how it behaves.
If issue still persist then it’s Maven/Vaadin issue. Otherwise it’s Netbeans issue.
Hello.
Spent some time tonight porting the source code to eclipse/maven (running under jetty) and the problem persists. No amount of reload/redeploy/widgetset compilation can make the JS changes applied to the running app. So i suppose we ruled out Netbeans (vs eclipse) and Tomcat (vs jetty) as the culprit, so that leaves either Maven or Vaadin.
Let me know if anyone wants to see the eclipse sources.
Thanks.
Hi, I think there is some checkbox in NetBeans to do resources deployment “on save”. Check out project properties if you can find something like that and if it makes a difference.
Thanks for the suggestion. All the features that i can think of is enabled, namely “Compile on Save”, “Deploy on save”, “Copy static resources on Save”, and i even tried enabling “always perform build before running applications”, but no dice. If you see my last message, i even tried it out on eclipse with the same results, so this is not a netbeans issue, as far as i can tell.
If nobody else is having this issue, can it be the maven archetype POM is wrong somehow?
The app was generated from the maven-archetype-application (7.3.0) archetype, POM.xml (unmodified from the archetype) attached.
This might be a browser issue as well. Javascript is only cached once and then again if the browser thinks, there is a new version. Unfortunately this does not work all the time, when the names stay the same.
You could try this:
Clear your browser cache and load the page again. If you have chrome you could as well press strg + shift + n which will open a private window, that does not cache. There it should ALWAYS load the javascript.
I had issues with javascript as well. I made changes but i could not see them on the browser. But as i said on my side this was due to the caching of the browser, so it still had the old JS.
EDIT: Damn, i saw that last reply too late But glad you figured it out yourself.