Using an IDE

This tutorial shows how to build, run and debug the application in an IDE. For a tutorial on how to build and run the application from the command line see the Running, building and packaging page.

Importing a project

Extract the project zip downloaded from https://vaadin.com/start/v14/full-stack-spring and import it into your IDE

Import to Eclipse:

  1. File → Import…​

  2. Maven → Existing Maven Projects, press Next

  3. Select the path to the extracted archive folder and click finish.

Import to IntelliJ IDEA:

  1. File → Open…​

  2. Select the path to the extracted archive folder

Building and Running

After the application is opened in an IDE and all dependencies are resolved there are several ways to run it.

Run as a Java Application

In Eclipse right click on the application folder in Package Explorer → Run As → Java Application. After that pick Application.java as the entry point class.

In IntelliJ IDEA right click on Application.java → Run ‘Application.main()’ or click on the green arrow at the main method line in the Application.java.

Idea Run Main

Note
There is a known issue with IntelliJ IDEA when a provided dependency is not in the classpath (https://youtrack.jetbrains.com/issue/IDEA-107048). So, if you are using an IDEA build older than 181.1818 then it is necessary to set the compile scope for the spring-boot-starter-tomcat dependency. Since compile is the default scope in maven, the dependency should be defined in pom.xml as:

XML

  1. <dependency>
  2. <groupId>org.springframework.boot</groupId>
  3. <artifactId>spring-boot-starter-tomcat</artifactId>
  4. </dependency>

Run as a Maven build

In Eclipse in Package Explorer right click on the application root folder or on the pom.xml file. Choose Run As → Maven Build…​ and specify spring-boot:run as the run goal. Give the configuration a name and click Run.

Once the Maven Run configuration is saved you can find it in Run Configurations

Eclipse Run Configuration

In IDEA, choose Run → Edit Configurations…​ in the main menu. Then in the Run/Debug Configuration dialog box, click + on the toolbar and select Maven as the configuration type. Enter spring-boot:run as the command line and press Ok.

IDEA Edit Configuration

IDEA Run

Press the green arrow to launch the app.

More about how to create and edit run/debug configuration in IntelliJ IDEA: https://www.jetbrains.com/help/idea/creating-and-editing-run-debug-configurations.html

To make a production build use the clean install -Pproduction maven goal. After a production build is done in `application-folder-path/target’ you can find the .war file which is ready to be deployed to an application server.

Debugging

In Eclipse same configurations can be used but should be run from Debug configurations.

In IDEA pick the configuration needed and click Debug Application button.

Automatic Restart and Live Reload

See Automatic restart