This project demos the possibility of having Vaadin project in npm+webpack mode using Gradle. Please see the Starting a Vaadin project using Gradle for the documentation.
Prerequisites:
- Java 8 or higher
- node.js and npm. You can either let the Vaadin Gradle plugin to install
nodejs
andnpm/pnpm
for you automatically, 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 Ultimate
Simply run the following command in this repo:
./gradlew clean build -Pvaadin.productionMode
That will build this app in production mode as a WAR archive; please find the
WAR file in build/libs/base-starter-gradle.war
. You can run the WAR file
by using Jetty Runner:
cd build/libs/
wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.26.v20200117/jetty-runner-9.4.26.v20200117.jar
java -jar jetty-runner-9.4.26.v20200117.jar base-starter-gradle.war
Now you can open the http://localhost:8080 with your browser.
Usually the CI images will not have node.js+npm available. Luckily Vaadin will download nodejs
and npm/pnpm
automatically, there is nothing you need to do.
To build your app for production in CI, just run:
./gradlew clean build -Pvaadin.productionMode
- Download and unpack the newest Tomcat 9.
- Open this project in Intellij Ultimate.
- Click "Edit Launch Configurations", click "Add New Configuration" (the upper-left button which looks like a plus
sign
+
), then select Tomcat Server, Local. In the Server tab, the Application Server will be missing, click the "Configure" button and point Intellij to the Tomcat directory.- Still in the launch configuration, in the "Deployment" tab, click the upper-left + button, select "Artifact" and
select
base-starter-gradle.war (exploded)
. - Still in the launch configuration, name the configuration "Tomcat" and click the "Ok" button.
- Still in the launch configuration, in the "Deployment" tab, click the upper-left + button, select "Artifact" and
select
Now make sure Vaadin is configured to be run in development mode - run:
./gradlew clean vaadinPrepareFrontend
- Select the "Tomcat" launch configuration and hit Debug (the green bug button).
If Tomcat fails to start with Error during artifact deployment. See server log for details.
, please:
- Go and vote for IDEA-178450.
- Then, kill Tomcat by pressing the red square button.
- Then, open the launch configuration, "Deployment", remove the (exploded) war, click
+
and selectbase-starter-gradle.war
.