2

All I want to do is extend the existing Vaadin theme called "Valo".

I'm using IntelliJ and Maven.

In my UI class:

@Theme("myTheme")
...
public class MyUI extends UI {
    ...
}

I've added styles.scss at src/main/webapp/VAADIN/themes/myTheme containing the following content:

$v-font-size: 12px;

$v-unit-size: 26px;
$v-unit-size--small: 20px;
$v-unit-size--tiny: 18px;

$v-layout-margin-top: 18px;
$v-layout-margin-right: 18px;
$v-layout-margin-bottom: 18px;
$v-layout-margin-left: 18px;
$v-layout-spacing-vertical: 7px;
$v-layout-spacing-horizontal: 6px;

@import "../valo/valo";

In my pom.xml I included the following dependency:

<dependency>
  <groupId>com.vaadin</groupId>
  <artifactId>vaadin-themes</artifactId>
  <version>${vaadin.version}</version>
</dependency>

And there I have veryfied the resources:

    <resources>
        <resource>
            <directory>src/main/resources</directory>
            <filtering>true</filtering>
        </resource>
        <resource>
            <directory>src/main/webapp</directory>
        </resource>
    </resources>

I get this error when trying to access my site:

Requested resource [/VAADIN/themes/myTheme/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder.

I guess that this is because the scss-file needs to be compiled.

To do so I added the following plugin in my pom.xml:

<plugin>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-maven-plugin</artifactId>
    <executions>
        <execution>
            <goals>
                <goal>update-theme</goal>
                <goal>compile-theme</goal>
                <!--
                <goal>clean</goal>
                <goal>resources</goal>
                <goal>update-widgetset</goal>
                <goal>compile</goal>
                -->
            </goals>
        </execution>
    </executions>
</plugin>

When compiling the project I get the following error:

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:7.6.0.alpha2:updat e-theme (default) on project classification-tool-webapp: The goal update-theme r equires Vaadin 7.1 or later -> [Help 1]

6
  • not loading as in "it takes longer" and everything is unstyled? do you get any errors? if your VaadinServlet runs in production mode, you have to have the styles.CSS in place. in debug mode it will compile scss on the fly - but you will have to find out, how to compile the theme anyway for your fat-jar/war.
    – cfrick
    Dec 18, 2015 at 14:13
  • I've updated my question and tried to be more specific.
    – mosquito87
    Dec 18, 2015 at 14:29
  • i dont use maven, so i cant test, but that error could as well be false positive. you might want to try 7.5.10 - also the current 7.6 is beta2
    – cfrick
    Dec 18, 2015 at 14:54
  • Where is your Maven property ${vaadin.version} defined?
    – Kirby
    Dec 18, 2015 at 17:46
  • 1
    Hi did u manged to solve this error? I am facing same issue Mar 11, 2016 at 10:39

1 Answer 1

0

TL;DR

Make sure that you have correct com.vaadin:vaadin-shared dependency

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-shared</artifactId>
    <version>${vaadin.version}</version>
</dependency>

Note: this dependency doesn't have to be explicit. You may already have it via other dependencies (e.g. com.vaadin:vaadin-server). Check your pom.xml

MORE DETAILS

Vaadin maven plugin checks the Vaadin version using the following code:

protected boolean isAtLeastVaadinVersion(int major, int minor) {
    // find "vaadin-shared" and check its version
    for (Artifact artifact : getProjectArtifacts()) {
        if (VAADIN_GROUP_ID.equals(artifact.getGroupId())
                && "vaadin-shared".equals(artifact.getArtifactId())) {
            // TODO this is an ugly hack because Maven does not tolerate
            // version numbers of the form "7.1.0.beta1"
            String artifactVersion = artifact.getVersion();
 (...)

In short, it goes through all dependencies looking for com.vaadin:vaadin-shared with specific version. It doesn't check actual jar but rather their maven metadata. That means that you may already have the correct JAR, for example with:

<dependency>
    <groupId>vaadin-shared-7.7.12</groupId>
    <artifactId>vaadin-shared-7.7.12</artifactId>
    <version>0</version>
    <scope>system</scope>
    <systemPath>lib/vaadin-shared-7.7.12.jar</systemPath>
</dependency>

but still the check in Vaadin maven plugin would fail. And you would get the exception

The goal update-theme requires Vaadin 7.1 or later

And vice versa - you may "cheat" the plugin having:

<dependency>
    <groupId>com.vaadin</groupId>
    <artifactId>vaadin-shared</artifactId>
    <version>${vaadin.version}</version>
    <scope>system</scope>
    <systemPath>lib/fake.jar</systemPath>
</dependency>

(where fake.jar IS NOT vaadin-shared.jar) and you'll pass the check (theme compilation won't work though, as you need the classes either way). So the solution for that exception is to make sure that you have the correct vaadin-shared with correct version.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.