Disons que j'ai deux projets. CompanyApp
et CompanyVaadinThemes
. CompanyApp est une application normale de Vaadin 7.7.3. CompanyVaadinThemesis juste un thème de Vaadin 7.7.3 compilé dans un pot.Comment puis-je importer des thèmes externes avec Vaadin et les utiliser avec des annotations?
CompanyVaadinThemes.jar
source/main/resources/VAADIN/themes/mytheme
mytheme.scss
styles.scss
...
CompanyApp.war
pom.xml
...
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>com.company</groupId>
<artifactId>company-vaadin-themes</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
UI.java
@SpringUI
@Theme("mytheme")
public class CompanyUI extends UI {
Cependant, je ne peux pas sembler comprendre comment faire ce travail. Si je copie le code réel de la CompanyVaadinThemes.jar dans le principal CompanyApp, tout va bien. Je peux utiliser "mytheme", "valo", etc.
Mais je veux garder le thème actuel dans un projet séparé afin que les futurs projets puissent simplement l'ajouter en tant que dépendance.
Voici le pom CompanyVaadinThemes:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>company-vaadin-themes</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<vaadin.version>7.7.3</vaadin.version>
<vaadin.theme>mytheme</vaadin.theme>
<vaadin.plugin.version>${vaadin.version}</vaadin.plugin.version>
</properties>
<repositories>
<repository>
<id>vaadin-addons</id>
<url>http://maven.vaadin.com/vaadin-addons</url>
</repository>
<repository>
<id>com-vaadin-prereleases</id>
<url>https://maven.vaadin.com/vaadin-prereleases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-server</artifactId>
<version>${vaadin.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-themes</artifactId>
<version>${vaadin.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
</plugin>
</plugins>
</build>
</project>
C'était exactement ça. J'avais mon dossier VAADIN au mauvais endroit. Je l'ai mis dans le dossier des ressources. Dur. Merci. – cbmeeks