Hello everyone! I am trying to run a page using Vaadin 23, but I get index.html on any url
My project uses:
java version=17
spring-mvc version=5.3.20
apache tomcat version=8.5.85
But as a dependency manager on the project we use ivy and ant (this is a legacy project)
I added settings for VaadinServlet in web.xml similar to the documentation (Properties | Configuration | Vaadin 23 Docs), and also defined VaadinApplicationConfiguration as a spring bean
My project compiles successfully and I do not see any errors related to Vaadin in the logs. I added a simple test page on Vaadin
@Route("vaadin/test")
public class TestView extends HorizontalLayout {
private TextField name;
private Button sayHello;
public TestView() {
name = new TextField("Your name");
sayHello = new Button("Say hello");
sayHello.addClickListener(e -> Notification.show("Hello " + name.getValue()));
sayHello.addClickShortcut(Key.ENTER);
setMargin(true);
setVerticalComponentAlignment(Alignment.END, name, sayHello);
add(name, sayHello);
}
}
when I go to the URL /vaadin/test, I get an empty index.html page from the META-INF/VAADIN/webapp folder
When I go to any other URL, I also get an empty index.html page
Really hard to say, but based on you saying you’re using Ivy and Ant, I’m presuming you’re missing the stuff that the Vaadin Maven Plugin does: How to create a production build in Vaadin Flow
Thanks for the answer ! Is it really mandatory to use the maven plugin when starting?
I tried to run the project from the documentation examples (skeleton-starter-flow-spring-23) without this plugin, removing it from pom.xml, and the project successfully runs without it
It’s a bit complicated, and depends a bit on whether you’re on v23 or v24, but the short answer is that most of the times, you’ll need it. If you’ve run the plugin once, and it has fetched all of the client-side dependencies, you might not need it again until you do some relevant changes, such as adding an add-on that has client-side dependencies. You’ll also need the plugin to create a production build.
If you can live without “frontend-build” (Lit/Polymer templates and custom theme), a setup like this might be best for you without a modern build tooling. This way you need no build plugins at all:
The above is for 24.x, I have never tried if similar approach works with Vaadin 23.x series.
We use cookies to serve our customers and website visitors in the best possible way. Cookies are used for the proper functioning of the website and for improving the user experience, monitoring visitor traffic and marketing purposes. By continuing to browse the site, you agree to our use of cookies. You can read more about cookies here.
We use cookies to serve our customers and website visitors in the best possible way. Cookies are used for the proper functioning of the website and for improving the user experience, monitoring visitor traffic and marketing purposes. By continuing to browse the site, you agree to our use of cookies. You can read more about cookies here.