vaadin / flow

Vaadin Flow is a Java framework binding Vaadin web components to Java. This is part of Vaadin 10+.
Apache License 2.0
610 stars 167 forks source link

Maven: "Theme name and theme class can not both be specified" with Material theme and themeFolder #15746

Open mvysny opened 1 year ago

mvysny commented 1 year ago

Description of the bug

Vaadin fails to build the production bundle for the annotation @Theme(value = Material.class, themeFolder = "my-theme"), with a strange error message:

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:14.9.5:build-frontend (default) on project project-base: Execution default of goal com.vaadin:vaadin-maven-plugin:14.9.5:build-frontend failed: Theme name and theme class can not both be specified. Theme name uses Lumo and can not be used in combination with custom theme class that doesn't extend Lumo. -> [Help 1]

If the themeFolder attribute isn't supported in connection with the Material theme, the error message should mention themeFolder instead of something called 'theme name'; or even better, the error message should mention that "Only the Lumo theme supports custom themes".

Expected behavior

Vaadin should either support Material custom theme according to the https://vaadin.com/docs/v14/flow/styling/custom-theme manual, or Maven should fail with a clearer error message.

Minimal reproducible example

  1. clone skeleton-starter-flow for Vaadin 14
  2. add @Theme(value = Material.class, themeFolder = "my-theme") to the MainView class
  3. mvn -C clean package -Pproduction

Versions

knoobie commented 1 year ago

Looking at the linked docs they state as limitation:

Using the built-in Material theme is not currently supported. Custom themes are always loaded on top of the Lumo theme.

mvysny commented 1 year ago

Yup, you're right, the documentation clears up everything. Still, the Maven plugin error message could be improved to mention the custom themes and Lumo. Essentially, the same line as the one from the documentation would be great.