0

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
Manish Patel
  • 4,411
  • 4
  • 25
  • 48
  • 1
    Remove the maven jar plugin, also you I suggest using the Vaadin Spring Boot Starter. – M. Deinum Sep 15 '17 at 09:32
  • @M.Deinum I haven't listed all deps here, but Vaadin Spring Boot Starter is already there. Maven jar plugin is there to create the fat jar – Manish Patel Sep 15 '17 at 09:34
  • 1
    Don't use the jar plugin.. Spring Boot already does that, also you are creating a jar not a war so your html templates should be somewhere else. – M. Deinum Sep 15 '17 at 09:35
  • Thanks, I rebuilt w/o the plugin but still the same issue. The question remains where to put those resources so that the application can find them – Manish Patel Sep 15 '17 at 10:01
  • 1
    in src/main/resources also you shouldn't be messing with the class path everything is in the jar. – M. Deinum Sep 15 '17 at 10:05
  • That's where resources are before packaging. I added `addResources` to the config of the plugin, but when I unzip the JAR I can see the resources aren't there. – Manish Patel Sep 15 '17 at 10:32
  • You don't need `addResources` why should they move? Do you also really need the vaadin plugin? – M. Deinum Sep 15 '17 at 10:34

0 Answers0