Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
How to pack Server side java script in executable jar file
I used @JavaScript in Vaadin UI, it works great in developement.
But after I use maven to package project to a single jar file.
Those java script files were not included.
Is there a way to specify in the build plugin to include those javascript files?
Thank you!
If your js files are stored under src/main/resources they should be included by default in the jar
The java script file is in the same directory as class file, there are similar post like this https://vaadin.com/forum#!/thread/4924537
I am using this way
package com.mycompany.ui;
@SpringUI(path="/tree")
@JavaScript("dbasTree.js")
public class TreeUI extends UI {}
No answer for relative path of java script file for @Javascript.
Even I added the java script file to the jar file. I got this error:
Rejecting published file request for file that has not been published: dbasTree.js
So I moved the dbasTree.js to src/main/resources/static and changed to @JavaScript("/dbasTree.js")
Run in development, got "Rejecting published file request for file that has not been published: dbasTree.js" too.
What is the best way to use @JavaScript in Vaadin UI and how can I package the file to production jar file?
Thanks!
In a standard maven project resources inside src/main/resources would be packaged into the jar;
so putting your file dbasTree.js inside src/main/resources/com/mycompany/ui and annotate UI class with @JavaScript("dbasTree.js") should work
HTH
Marco