I have a Maven project that depends on spring-boot
and all the Vaadin required dependencies. The structure of the project is:
src/
main/
java/ (all java files here)
resources/ (all properties/yml files here for Spring)
webapp/VAADIN/themes/myapp/ (all webapp stuff here, including HTML templates)
I use embedded tomcat to host the application.
I create a fat jar using maven-jar-plugin
, and deploy this to an external server. I thought I would need webapp
and compiled classes
folder on the classpath too, so I do the following to start the application:
java -Dspring.profiles.active=prod -classpath "classes;webapp" -jar app.jar
Now the application does start up. However it seems that the compiled stuff doesn't get picked up. E.g. in the log file I see:
CustomLayout not found: layouts/login.html
And the resulting login webpage has the text (without theme):
Layout file layouts/login.html is missing. Components will be drawn for debug purposes.
NB I've tried to do this without the maven jar plugin too, but still hit the same issue
I get the distinct feeling I'm just going this wrong. I think I should be packaging the VAADIN compilation into the jar (how to do this?).
Additional Info
Maven plugins (for running from IDE and packaging fat jar):
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>8.0.5</version>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile-theme</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>my.domain.MyApp</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
Other dependencies:
- spring-boot-starter-parent
- spring-boot-starter
- vaadin-spring-boot-starter
- vaadin-themes
- other internal deps