This project demoes the possibility of having Vaadin 14 project in npm+webpack mode using Gradle and Spring Boot. Please see the Vaadin Gradle Plugin Page for documentation.
Prerequisites:
- Java 8 or higher
- node.js and npm. Vaadin Gradle plugin will install those for you
automatically (handy for CI), or you can install it to your OS:
- Windows: node.js Download site - use the .msi 64-bit installer
- Linux:
sudo apt install npm
- Git
- (Optionally): Intellij Community
- The v14 branch (the default one) contains the example app for Vaadin 14
- The master branch contains the example app for Vaadin 17
Run the following command in this repo:
./gradlew clean bootRun
Now you can open the http://localhost:8080 with your browser.
Run the following command in this repo, to create necessary Vaadin config files:
./gradlew clean vaadinPrepareFrontend
The build/vaadin-generated/
folder will now contain proper configuration files.
Open the DemoApplication
class, and Run/Debug its main method from your IDE.
Now you can open the http://localhost:8080 with your browser.
Run the following command in this repo:
./gradlew -Pvaadin.productionMode
That will build this app in production mode as a runnable jar archive; please find the
jar file in build/libs/base-starter-spring-gradle*.jar
. You can run the JAR file
with:
cd build/libs/
java -jar base-starter-spring-gradle*.jar
Now you can open the http://localhost:8080 with your browser.
Usually the CI images will not have node.js+npm available. However, Vaadin Gradle Plugin will download it for you automatically, there is no need for you to do anything. To build your app for production in CI, just run:
./gradlew clean build -Pvaadin.productionMode