RE: Cant get the custom theme to work

Have you compiled the theme and project?

Hello Guys,

I’m trying to get my theme to work but Vaadin doesnt see it.

Ive read the dcoumentation and nothing seems to work.

Under my src/main/resources I created the following structure

VAADIN > themes > mytheme

I added mytheme.scss , style.scss and addons.scss

I even added a style.css and added the following

@import “…/valo/styles.css”;

.v-app {
background: yellow;
}

Nothing changes. Any help would be appreaciated.

Ive tried 2 ways to compile and both has failed.

I think the issue may be that I have the theme in src/main/resources instead of src/main/webapp
But I’m not the java developer, Im the ui dev.

I tried the plugin for spring to compile and when I run it, I receive the following message

[INFO]
Scanning for projects…
[WARNING]

[WARNING]
Some problems were encountered while building the effective model for com.shl.core.web:ta-cds-core-web:jar:0.0.1-SNAPSHOT
[WARNING]
‘dependencies.dependency.(groupId:artifactId:type:classifier)’ must be unique: com.vaadin:vaadin-themes:jar → duplicate declaration of version (?) @ line 98, column 15
[WARNING]

[WARNING]
It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]

[WARNING]
For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]

[INFO]
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
[INFO]
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
[INFO]
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 KB at 21.9 KB/sec)
[INFO]
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 31.4 KB/sec)
[INFO]

[INFO]
BUILD FAILURE
[INFO]

[INFO]
Total time: 2.573 s
[INFO]
Finished at: 2017-12-20T10:11:36-05:00
[INFO]
Final Memory: 22M/309M
[INFO]

[ERROR]
No plugin found for prefix ‘vaadin’ in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo]
available from the repositories [local (C:\Users\dan.kelly.m2\repository), central (https://repo.maven.apache.org/maven2)]
→ [Help 1]

[ERROR]

[ERROR]
To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR]
Re-run Maven using the -X switch to enable full debug logging.
[ERROR]

[ERROR]
For more information about the errors and possible solutions, please read the following articles:
[ERROR]
[Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

I’ve also added this so maven would find and compile but doesnt work either

org.codehaus.mojo exec-maven-plugin 1.2.1 generate-sources java compile com.vaadin.sass.SassCompiler src/main/resources/VAADIN/themes/mytheme/styles.scss src/main/resources/VAADIN/themes/mytheme/styles.css

Are you using the custom theme in a spring boot application?
(In case you dont know waht I mean, because you are not the Java Developer: Does the UI of the Application has a Annotation called ‘@SpringUI’)

If you are using Spring for your Applikation make sure to add this to your pom.xml:

Under section build:
src/main/resources This tells the Build to also look in src/main/resources for themes as well for the widgetset.

Also you need the Vaadin maven plugin in your Build. Ill just copy my whole pom.xml build section here for you, that you can find out differences.

src/main/resources maven-clean-plugin 3.0.0 ${basedir}/src/main/resources/VAADIN/ widgetsets//* themes//*.css org.springframework.boot spring-boot-maven-plugin com.vaadin vaadin-maven-plugin ${vaadin.version} -Xmx2G -Xss1024k ${basedir}/src/main/resources ${project.build.directory} ${project.build.directory}/gwt-deploy false true false DETAILED true http://localhost:8080/ resources update-theme update-widgetset compile If you have this in your pom.xml maven and spring boot will find the theme.

P.S.: Also make sure you have the Annotation ‘@Theme(“…”)’ on top of your MainUI.