Best practice for AbstractJavaScriptComponent and *.js location?

Dear all,

I am looking for best practices for the location of the *.js files for AbstractJavaScriptComponents.


Problem:

I am using vaadin with eclipse and maven. I am packaging my application into a war file. According to the examples, the *.js files for an AbstractJavaScriptComponent should be located in the same folder where the class is located. This is also my current setup.

When I build the war from within eclipse, everything is fine, and the *.js file is included into the war file in the class folder.

However, when I build the war from the commandline (mvn clean install), the *.js-Files are not included into the class folder.

According to the i-net, *.js files should be placed into a separate folder (e.g. webapp/js), where Maven is packaging them correctly. When I follow this approach and put an absolute link on the AbstractJavaScriptComponent:

@JavaScript({ "/js/my_js.js" })

the *.js is not found, as the browser is trying to call:

http://localhost:8080/MyApp/APP/PUBLISHED//js/my_js.js

What would be the best solution?

  1. Continue compiling from eclipse (not really an option)
  2. Playing with Maven (war plugin(?)) that the *.js files are included in the class folder (how can this be done?)
  3. Playing around with the path in @JavaScript to reach …/MyApp/js/*.js (not very portable, how could this be done?)
  4. What else?

Thanks for thoughts and recommendations!

yes,it did;I get this so.

When you put *.js under APP/PUBLISHED ,it doesn’t work elso ! Waiting for someone!

The absolute link on the AbstractJavaScriptComponent:
@JavaScript(value = { “vaadin://APP/PUBLISHED/spinner.js”})

Just put spinner.js under VAADIN/APP/PUBLISHED,then it works.