How and where are front-end resources generated?

I am new to Vaadin and am playing around with a Gradle-based Vaadin/Spring Boot starter project. Here’s my full build.gradle:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.0.RELEASE")
    }
}

plugins {
    id 'java-library'
}

apply plugin: 'org.springframework.boot'

repositories {
    mavenLocal()
    mavenCentral()
    jcenter()
}

dependencies {
    compile(
        'ch.qos.logback:logback-classic:1.2.3'
        ,'org.slf4j:jul-to-slf4j:1.7.25'
        ,'org.apache.commons:commons-lang3:3.7'
        ,'commons-io:commons-io:2.6'
        ,'org.apache.commons:commons-text:1.2'
        ,'com.google.guava:guava:23.0'
        ,'com.vaadin:vaadin-spring-boot-starter:13.0.8'
        ,'org.springframework.boot:spring-boot-starter-actuator:2.1.0.RELEASE'
        ,'org.springframework.boot:spring-boot-starter-data-jpa:2.1.0.RELEASE'
        ,'com.h2database:h2:1.4.197'
    )

}

sourceCompatibility = 1.8
targetCompatibility = 1.8
String buildName = 'vaadin-spring-example'

jar {
    baseName = buildName
}

When I run ./gradlew clean bootJar that Gradle packages up a self-contained executable JAR for me at build/libs/vaadin-spring-example.jar. If I then run that JAR via java -Dspring.config=. -jar build/libs/vaadin-spring-example.jar it starts up without any issues and I can see my app load up at http:localhost:8080 without any issues.

My question is: at what point does Vaadin generate front-end resources (HTML/JS/CSS) for me? Is it happening during that bootJar task, or does it happen on the fly the first time the app is requested by a user?

Hi.

The frontend resources come through vaadin-spring-boot-starter which depends on vaadin-core that brings with it the org.webjars.bowergithub.vaadin jars which contain the frontend resources for the components themselves.
Those are then served from the jar files on request by Vaadin.

If you would make a production build all those files would be copied, transpiled, bundled and minified during a step in the jar creation.

  • Mikael

Thanks Mikael, good to know! I assume I could specify production mode in Gradle like so:

/gradlew clean bootJar -Pproduction-mode

Am I close? Thanks again!